Forum Moderators: phranque

Message Too Old, No Replies

redirectMatch question

.htaccess

         

SlowMove

1:33 am on Aug 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I had an old directory "www.site.com/foo/" and I used the following directive to 301 all the pages in that directory and subdirectory to "www.site.com/bar/index.html".

redirectMatch permanent foo/.* h**p://www.site.com/bar/index.html

No problem until I realized that I created a "foo" subdirectory in the new "bar" directory. So, if someone goes to "www.site.com/bar/foo/anypage.html", they're redirected to "www.site.com/bar/index.html". Not exactly what I had in mind. I thought I had a decent understanding of regular expressions, but nothing I tried seems to kill the old directory without killing the new subdirectory. Any help would be greatly appreciated.

jdMorgan

2:00 am on Aug 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Start-anchor your pattern:

RedirectMatch permanent [b]^/[/b]foo/ h**p://www.site.com/bar/index.html

Jim

SlowMove

2:12 am on Aug 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That works great. Thank you very much.