I'm using this .htaccess code to remove my .php extension <code> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA] </code> Let's say I have a called FileCode.php. I can load that file with no problem in my browser as www.domain.com/FileCode However, when I try to retrieve a parameter like www.domain.com/FileCode/param1, my FileCode is not able to be run. It only works when I have www.domain.com/FileCode.php/param1 What can I do to fix the .php extension problem?
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([.\/]*)$ $1.php [L,QSA] Try this. Let me know if it works. Matthew
Regex always make my head hurt, but I think what you want is: RewriteRule ^([a-zA-Z0-9]+)$ $1.php [L,QSA] RewriteRule ^([a-zA-Z0-9]+)/(.*)$ $1.php/$2 [L,QSA] That may not be quite right, but anyway you're rewriting www.domain.com/FileCode/param1 as: www.domain.com/FileCode/param1.php wheras you want: www.domain.com/FileCode.php/param1
I think you will need a specific rewrite rule for all your pages that take paramaters: RewriteRule Filecode\/(.*)$ Filecode.php/$1 [L,QSA]