Forum Moderators: phranque

Message Too Old, No Replies

rewrite rules for a directory change (from one dir level to two)

rewrite rules for a change in directory structure

         

Gray_Fox

7:35 pm on Apr 3, 2008 (gmt 0)

10+ Year Member



I'm transferring all of our photos from static html pages to gallery2, and was wondering how to do the rewrite rules without having to set up some 250+ 301 redirects.

Old structure:
example.com/photos/page.html

New structure:
example.com/photos/animals/page.html

I'm wondering if this is even possible. The actual filename remains the same, it's just the directory structure that changes.

Thanks for any help,

Cedric

Samizdata

8:18 pm on Apr 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm wondering if this is even possible

If I understand you right RedirectMatch should do what you want:

RedirectMatch 301 ^/folder/(.+)$ http://www.example.com/folder/subfolder/$1

I didn't test it and I recommend reading previous posts in this forum which answer every .htaccess question I have ever been able to think of (often more than once).