Forum Moderators: phranque

Message Too Old, No Replies

Need help writing conditional redirect

         

b8caster

2:30 am on Sep 14, 2010 (gmt 0)

10+ Year Member



Hello,
I have a bunch of pages in directory /x/ that I'm moving to directory /y/. How do I write a 301 conditional redirect rule in htaccess for all those files?

I'm running Apache 2.2

jdMorgan

11:16 pm on Sep 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




RewriteRule ^x/(.*)$ http://www.example.com/y/$1 [R=301,L]

Better yet, move the files from /x/ to /y/, but don't change the URLs at all:

RewriteRule ^x/(.*)$ /y/$1 [L]

Jim

b8caster

3:30 am on Sep 15, 2010 (gmt 0)

10+ Year Member



Yep, that worked like a charm. Thank you!