Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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...

http://www.mysite.com/folder1/*

to

http://www.mysite.com/folder2/*

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.