htaccess can't redirect home directory

htaccess can't redirect home directory

Posted by: cserrano
Posted on: 2007-05-07 11:33:00

So, I'm trying to 301 my root directory to a sub directory - my .htaccess redirect works fine from the sub directory to the root, but not the other way around.

Works fine:
Redirect 301 /sub-directory http://www.mydomain.com

Doesn't work:
Redirect 301 / http://www.mydomain.com/sub-directory

It trys to redirect to a url like this:
http://www.mydomain.com/sub-directorysub-directorysub-directory-subdirectory etc.

Re: htaccess can't redirect home directory

Posted by: Atropos7
Posted on: 2007-05-07 16:53:00

Actually it is working just fine.

After reading the

Re: htaccess can't redirect home directory

Posted by: khatfield
Posted on: 2007-05-08 08:29:00

Just use a php redirect like index.php:
<?php
header( 'Location: http://www.yoursite.com/new_page.html' ) ;
?>

Save

Tags: htaccess redirectmydomainroot directoryhome directory