Forum Moderators: phranque
I need to rename one of my main directories. Obviously when I do this, visitor's bookmarks, and possibly some of my own internal links, will stop working. I want to redirect all requests for the old file location to the new locations. For example:
h*tp://mydomain.com/olddirectory/file.html
would be redirected to . . .
h*tp://mydomain.com/newdirectory/file.html
What with hundreds of files in that directory, I obviously don't want to create separate redirect rules for each file. Is there any way I can use .htaccess to create some sort of "wildcard" rule that will accomplish what I want? In other words, a .htaccess rule that will redirect all of the old directory files to the same file name in a new directory.
Thanks,
Matthew
Sure, it's easy:
Redirect 301 /olddirectory http://mydomain.com/newdirectory
It's actually more difficult to *not* redirect all files - You have to use RedirectMatch to do that.
See Apache mod_alias [httpd.apache.org]
Jim