Redirect root directory to a subdirectory using .htaccess

By | August 23, 2010

Every so often I need to redirect from the root directory http://www.someserver.com to http://www.someserver.com/blah. The first thing I try is always something like:

[text]
# This does not work
RedirectMatch permanent / /blah
[/text]

This ends up not working with Firefox reporting “the page isn’t redirecting properly”. I guess the server gets confused and redirects indefinitely so you must do this instead:

[text]
# Redirect from / to /blah
RedirectMatch permanent ^/$ http://www.someserver.com/blah
[/text]

*cheers*

Leave a Reply

Your email address will not be published. Required fields are marked *