Ruben Laguna’s blog

How to Redirect Your Root Web Directory to a Subfolder With .htaccess

If you tried (like me) to redirect your / (root) web directory to a subfolder (like /wp/) modifying .htaccess in this way:

1

1
<span class='line'>Redirect 301  / http://rubenlaguna.com/wp/</span>

You probably found that it didn’t work. The browser will end up in an endless loop of redirections. Firefox will complain with this error message:

The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept cookies.
The right way to accomplish the root to subfolder redirection is the following:

1

1
<span class='line'>RedirectMatch permanent ^/$ http://rubenlaguna.com/wp/</span>

Hope it helps

Comments

Copyright © 2015 - Ruben Laguna - Powered by Octopress