Cequiel Cequiel - 18 days ago 6
PHP Question

Apache2: how to NOT remove php extensions?

All people ask about "how to remove php extensions", but I want to make the opposite. By default, my Apache configuration "hides" the PHP extension from the url. That is, both urls access the same script:

my/path/myscript
my/path/myscript.php


Is it possible to "NOT" remove the php extension?
I'm using Ubuntu 16.04 and Apache2.

This is my .htaccess file:

Options +FollowSymlinks
RewriteEngine on

# Woff type
AddType application/x-font-woff .woff

# Display PHP errors on development stage
# This line should be removed on production stage
php_flag display_errors On

# redirects all requests to index.php
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

Answer

Simply add the following line into your .htaccess file to disable the "Multiviews" feature:

Options -Multiviews