Update: Is report a reserved word or some sort of special string in mod rewrite? I have changed the file name to report1 and the rules are working fine.
Original Question:
I cannot get a specific file /www/admin/report.php to work with my rewrite rules. I want to have the php extension removed and append a category value to the /admin/ path, like this:
https://url.com/car/admin/report But for some reasons the url only works with the extension present:
https://url.com/car/admin/report.php I have uncommented the other rules to test. Here are the rules that should remove the php extension:
RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L] RewriteCond %{THE_REQUEST} /index\.php [NC] RewriteRule ^([^\.]+)$ $1.php [NC,L] RewriteCond %{REQUEST_URI} /(admin|search)/(.*) RewriteRule ^(.*)/(.*)/(.*)?$ $2/$3?category=$1 [NC,QSA] // I make it less specific so it works with any filenames other than report.php as well I have tried adding .php to the last rule but that won't work either
RewriteRule ^(.*)/(.*)/(.*)?$ $2/$3.php?category=$1 [NC,QSA] Any help would be appreciated.
/car/directory? Also what is your last rule supposed to be doing? I don't see a requirement for?category=...