Reputation: 893
I'm dealing with a server that has mod_rewrite enabled but I can't seem to get any rewrites to work except one...
The following works
RewriteEngine on
RewriteRule (.*) /test.php [R=301,L]
But obviously creates an endless loop back to test.php. So if I type website.com/something, it's being redirected to test.php which is then redirected to itself endlessly.
However, something like this isn't working:
RewriteEngine on
RewriteRule /something.html /something.php [R=301,L]
Any ideas what I'm doing wrong?
Upvotes: 0
Views: 20
Reputation: 1011
I think you need to add base and supply base symbol (^) to rule.
RewriteEngine on
RewriteBase /
RewriteRule ^something.html /something.php [R=301,L]
RewriteRule ^(.*) /test.php [L] #this rule must not issue 301 redirect
Upvotes: 1