2014-03-01 50 views
1

我有网站http://example.com/~myhome/。我想临时将http://example.com/~myhome/dir1/重定向到http://example.com/~myhome/dir2/重定向规则不适用于htaccess中的index.php

我写了下面行我.htaccess这是dir1

RewriteEngine On 
Redirect 302 /~myhome/dir1/ http://example.com/~myhome/dir2/ 
Redirect 302 /~myhome/dir1/(.*) http://example.com/~myhome/dir2/$1 

问题里面有这个代码是,这是在dir1/每个文件重定向到dir2/正确,但index.php被重定向到http://example.com/dir2/index.php

+0

不,这是行不通的。是的,浏览器缓存了旧的301重定向。我清除了缓存,我的代码工作。 – Dheerendra

回答

1

您需要在我的.htaccess这是DIR1内以下行:

RewriteEngine On 

RewriteRule ^(.*)$ /~myhome/dir2/$1 [L,R]