I have tried a bunch of different ways now and am getting very frustrated
Options -Indexes Options +MultiViews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php ^ Doesn't work at all
Options -Indexes Options +MultiViews <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Unless directory, remove trailing slash RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/$ http://squeakcode.com/$1 [R=301,L] # Redirect external .php requests to extensionless url RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/ RewriteRule ^(.+)\.php$ http://squeakcode.com/$1 [R=301,L] # Resolve .php file for extensionless php urls RewriteRule ^([^/.]+)$ $1.php [L] </IfModule> ^Works but goes to a page that doesn't exist.
As mentioned the second code snippet works sort of. The problem is that it removes .php but doesn't pull the .php file so it goes to a not found page.
Am I missing something in my Apache config?
.phpfiles located?/to the rule./$1.php. I've seen some servers try to use the full absolute path in the URL like (http://domain.com/var/www/file.php) which will give a 404.