Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

Try this:

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

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

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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