I would like to remove the .php extension from my website.
I have this structure: /var/www/site/
FYI, in folder site, I have a lot of subfolders.
In site folder, I create .htaccess file. I inputed these line of code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
</IfModule>
After this change the website still require .php extension. So I tried to modify Apache2.conf and to add:
<Directory /var/www/site>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
I restarted the server with:
sudo service apache2 restart
After that, the website is still requiring the .php extension on localhost.
Any idea what am I doing wrong? Is there other solutions?