Forum Moderators: phranque

Message Too Old, No Replies

htaccess redirect issue

htaccess redirecting everything within folder

         

mjasra23

4:25 pm on Jun 28, 2006 (gmt 0)

10+ Year Member



Hi,

I have the following redirect setup in my htaccess file:

Redirect permanent /sightseeing/ http://www.example.com/sightseeing.aspx

It works well when wanting to redirect the home page of sightseeing over to the new website. However this code is redirecting all pages within the sightseeing directory. I know an option would be to specify /sightseeing/index.html, BUT lets just say that is a last case option. Is there anything else I can add to only redirect the specified folder's home page (i.e.: some kind of stop character)?

[edited by: jdMorgan at 6:10 pm (utc) on June 28, 2006]
[edit reason] example.com [/edit]

jdMorgan

6:10 pm on Jun 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use RedirectMatch [httpd.apache.org] instead:

RedirectMatch permanent ^/sightseeing/?$ http://www.example.com/sightseeing.aspx

RedirectMatch uses regular expressions: "^" marks the 'start', "$" marks the 'stop', and "/?" means it will match with or without a trailing slash.

For more information, see the documents cited in our forum charter [webmasterworld.com].

Jim

mjasra23

6:33 pm on Jun 28, 2006 (gmt 0)

10+ Year Member



Thanks! Worked Great