Lightwalker
asked on
htaccess redirect 301 needs to end if matched
Hi,
I have a site that has been moved from one domain to another and the URL's have been changed so I have many different redirect 301 i.e
redirect 301 /category/heath-and-beauty /herbs/ http://newdomain.com/health/into-the-bliss/category/heath-and-beauty/herbs/
this works fine but I wanted to add this rule so that if there is anything that does not match the redirect 301 then this rule will come into effect
Options +FollowSymLinks
RewriteEngine On
RewriteRule (.*) http://newdomain.com/health/into-the-bliss/$1 [R=301,L]
The problem is that when I add the above rewrite rule all the previous redirect 301 are ignored and it only used the RewriteRule. So I need to end the redirect 301 when a rule matches. I tried
redirect 301 /category/heath-and-beauty /herbs/ http://newdomain.com/health/into-the-bliss/category/heath-and-beauty/herbs/ [L]
but the [L] can only be used in a rewrite rule, is there a way to exit the rule on match on a redirect 301 that comes above the rewrite rule.
many thanks for your help
I have a site that has been moved from one domain to another and the URL's have been changed so I have many different redirect 301 i.e
redirect 301 /category/heath-and-beauty
this works fine but I wanted to add this rule so that if there is anything that does not match the redirect 301 then this rule will come into effect
Options +FollowSymLinks
RewriteEngine On
RewriteRule (.*) http://newdomain.com/health/into-the-bliss/$1 [R=301,L]
The problem is that when I add the above rewrite rule all the previous redirect 301 are ignored and it only used the RewriteRule. So I need to end the redirect 301 when a rule matches. I tried
redirect 301 /category/heath-and-beauty
but the [L] can only be used in a rewrite rule, is there a way to exit the rule on match on a redirect 301 that comes above the rewrite rule.
many thanks for your help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No problem. Glad I could help.
ASKER
worked great, the only thing I had to change was the beginning slash so the rewrite was:
RewriteRule ^category/heath-and-beauty