Reputation: 2794
Basically I want rewrite engine to kill any URI's that have ".php" in it.
So I've got this, but it doesn't seem to work...
RewriteCond %{REQUEST_URI} ^(\.php)+$
RewriteRule ^/$ 404[L]
Even just RewriteRule ^(.*.php)+/$ 404 doesnt' work.
Maybe my brain is stunned from working on this proj all day, so it could be a little error.
Thanks
Upvotes: 1
Views: 118
Reputation: 2794
You can't have a RewriteRule that redirects a URI to a php file; it becomes a loop hole with the first cond being ^(php).
Upvotes: 0
Reputation: 49885
Try this:
RewriteRule ^(login|register)$ $1.php [NC,QSA,L]
RewriteCond %{SCRIPT_FILENAME} !\/(login|register)(\.php)? [NC]
RewriteCond %{REQUEST_URI} \.php$
RewriteRule (.*) 404 [L]
the (login|register|etc...) are the file name. It means: login OR register OR some other file if you have more than one. If you only have 1 you can use (login) or login
Upvotes: 3