Problems with Rewrite PHP / Apache

1

2 days ago I changed from Linux distro and I am now using Elementary OS. I installed Apache, Mysql and PHP manually, in the same way that I installed in the previous distro, but I am having problems with Rewrite (friendly urls). In the previous distro it worked correctly, but in that distro it is not working. See below the .htaccess, which works correctly:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]

At the terminal I gave the following command:

sudo a2enmod rewrite

I restarted Apache:

sudo systemctl restart apache2

Then in the file:

  

/etc/apache2/sites-available/000-default.conf

I've included this block:

<Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
</Directory>

Again I restarted Apache, but the problem still persists, that is, when I click the site link: tell us / , it shows that the page was not found. Remember that in the remote server and in the previous distro, it worked correctly and the file talk-nos.php exists.

    
asked by anonymous 26.02.2018 / 19:36

1 answer

2

This is my /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    #DocumentRoot /var/www/html  # << ANTIGO
    DocumentRoot /home/user/Desenvolvimento/web

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    #REMOVI OS COMENTARIOS DESNECESSARIOS PARA A RESPOSTA
</VirtualHost>

/etc/apache2/apache2.conf

# .... alguns outros códigos também, mas o interesse é aqui

#<Directory /var/www/html/>     <<<DEFAULT  [padrão]
<Directory /home/user/Desenvolvimento/web/>  #TROQUE PARA o seu diretório desejado
    Options Indexes FollowSymLinks
    #AllowOverride None           <<< DEFAULT [pode ignorar]
    AllowOverride All
    Require all granted
</Directory>

#alguns outros códigos......
    
26.02.2018 / 20:30