Forum Moderators: phranque

Message Too Old, No Replies

Forwarding with .htaccess

Renaming a directory, want to forward all files to the new locations

         

MatthewHSE

4:49 pm on Feb 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I'm having to rename one of my main website directories. In order to help make the transition smoother, I want to forward all files to the new location. For instance:

h*tp://mydomain.com/olddirectory/file1.html

would be forwarded to:

h*tp://mydomain.com/newdirectory/file1.html

However, I can't do this with individual redirect rules in my .htaccess file, as there are hundreds of files to be redirected.

So is there a .htaccess rule I can create that will use some sort of "wildcards" to forward all these files to the new location?

Thanks,

Matthew

choster

5:32 pm on Feb 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It can be done using regular expressions; I'm sure there are examples floating about in the Apache Web Server [webmasterworld.com] forum.

BarkerJr

2:42 am on Feb 27, 2004 (gmt 0)

10+ Year Member


If you only specify the directory, it'll redirect all the requests for URLs under that directory.

Forward:
h*tp://mydomain.com/olddirectory
to:
h*tp://mydomain.com/newdirectory