Forum Moderators: phranque

Message Too Old, No Replies

Rewrite rule to change directories

         

rover

6:09 pm on Apr 4, 2004 (gmt 0)

10+ Year Member



Hi. I can't seem to produce a rewrite rule for an .htaccess file in the directory_original directory that will allow me to redirect the following url:

domain.com/directory_original/run.cgi?ID=23&cat=19

to:

domain.com/directory_new/run.cgi?ID=23&cat=19

Does anyone know how that could be done?

jdMorgan

11:45 pm on Apr 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



rover,

Here's a good place to start: Introduction to mod_rewrite [webmasterworld.com].

Jim

rover

12:04 am on Apr 6, 2004 (gmt 0)

10+ Year Member



Thanks very much, I'll check that out.

The Contractor

12:27 am on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually I had success changing the paths to a pretty large site by having the following simple redirect in .htaccess

Options +FollowSymLinks
redirect 301 /directory_original/ [domain.com...]

I have used the above on other servers also that do not require the "Options +FollowSymLinks" as this was already set in the master .htaccess of the hosting account.

Edited: just wanted to add this only will work of course if the files are of the same name in both the new and old directory/path.
I have also experienced some servers that need to have the trailing slashes removed to accomplish the same thing:
redirect 301 /directory_original [domain.com...]