Forum Moderators: phranque

Message Too Old, No Replies

Simple redirect question.

         

gosman

1:10 pm on Sep 6, 2005 (gmt 0)

10+ Year Member



I have a site that has backlinks to an old directory that no longer exists. Lets call this mysite/dir1

I want to redirect mysite/dir1 to a another relevant directory. Lets call this mysite/dir2

How do I do this using .htaccess

jazzle

4:02 pm on Sep 6, 2005 (gmt 0)

10+ Year Member



putting your .htaccess file in the root of your site with the following contents

RewriteEngine On
RewriteRule ^dir1(/.*)?$ http://www.example.com/dir2$1 [R=301,NC,L]

should do it, assuming that by 'mysite' you meant www.mysite.com

gosman

4:47 pm on Sep 6, 2005 (gmt 0)

10+ Year Member



Cheers Jazzle.

Works fine.

jazzle

5:02 pm on Sep 6, 2005 (gmt 0)

10+ Year Member



Excellent, happy to help :)

dipa

11:59 am on Sep 8, 2005 (gmt 0)

10+ Year Member



Hello,

pls explan the syntax,I hv the same problem.
^dir1(/.*)?$ http://www.example.com/dir2$1 [R=301,NC,L]

Thanks,
d

jdMorgan

1:26 am on Sep 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



dipa,

The documents cited in our forum charter [webmasterworld.com] should help you get started. Also see the Apache Forum section of the WebmasterWorld library [webmasterworld.com].

Jim