I'm using the latest version of IIRF to handle URL redirections (301s) for SEO. I'm having problems figuring out the syntax for this rule though.

I'm trying to redirect URLs which match this pattern...




Where the * is the part of the URL I'm trying to preserve.

The closest I've got is...

RedirectRule ^/folder1/$ /folder2/ [I,R=301]

...however that doesn't append the rest of the URL.

Any help would be appreciated.


Try this:

RewriteRule ^/folder1/(.*[^/])$ /folder2/$1 [I,R=301]

It should pick up everything after folder1/* till next / and append it after /folder2/

  • Actually one of my colleagues just figured it out. But thanks for your contribution, I'll accept your answer. The actual rule I used was: RedirectRule ^/folder1/(.*) /folder2/$1 [I,R=301] – DaveN Feb 17 '11 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.