I have an apache2 installation on my local linux server. It has a virtual host called pcts.local
which has the root /var/www/repos/pcts/
. Inside the root of pcts.local is a .htaccess file which attempts to rewrite urls to include .php if it isn't given like below:
http://pcts.local/ -> http://pcts.local/index.php
http://pcts.local/contact -> http://pcts.local/contact.php
The problem is, http://pcts.local/contact
gives an error 404 but http://pcts.local/contact.php
gives 200.
Virtual Host Configuration:
<VirtualHost *:80>
ServerName pcts.local
ServerAdmin webmaster@localhost
DocumentRoot /var/www/repos/pcts
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
.htaccess file in /var/www/repos/pcts/
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.+)$ $1.php [NC,L]
Thanks in advance of any help!