htaccess redirect 301 needs to end if matched


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/

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 (.*)$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/ [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
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian M.Web DeveloperCommented:
What about this?

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/category/heath-and-beauty/herbs/$ [R=301,L]
RewriteRule ^(.*)$$1 [R=301,L]

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LightwalkerAuthor Commented:
Thank you julianmatz,
worked great, the only thing I had to change was the beginning slash  so the rewrite was:

RewriteRule ^category/heath-and-beauty/herbs/$ [R=301,L]
Julian M.Web DeveloperCommented:
No problem. Glad I could help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.