I'm using a virtual machine to emulate an apache server (linux debian), and I can't manage to hide the .php file extension on the website's URL.
I'm modifying the apache2.conf in /etc/apache2/apache.conf instead of adding a .htaccess file because Apache suggests to do so.
I currently have:
<Directory /var/www/html>
AllowOverride All
Require all granted
RewriteEngine On
Options FollowSymLinks
RewriteCond %{REQUEST_FILENAME}.php !-f
RewriteRule (.*) $1.php [L]
</Directory>
I suggest you to use .htaccess in directories where you want to run php files without extension.
Depends on the version of your PHP engine, add the following lines:
<FilesMatch '^[^.]+$'>
SetHandler application/x-httpd-php70
</FilesMatch>
<FilesMatch '^[^.]+$'>
SetHandler application/x-httpd-php70s
</FilesMatch>
<FilesMatch '^[^.]+$'>
SetHandler fcgid70-script
</FilesMatch>
Don't forget to remove the .php extension from such files in those directories.