2012-02-09 99 views
0

我应该为页面列表做内部重定向(301)。 首先当用户打开/或/index.php时,他应该被重定向到em.php,放在根文件夹中。当用户打开/contents/about_us/index.php他应该被重定向到about_us/enterprise.php 听起来很简单,但我仍然无法解决 当我使用这个多一个重定向301

Redirect 301/http://foo2.bar.com/service 
Redirect 301 /index.php http://foo2.bar.com/service 

它的工作原理。 但当我尝试这个

Redirect 301/http://www.site.com/em.php 

我越来越http://www.site.com/em.phpem.phpem.phpem.phpem.phpem.phpem.phpem.phpem.php ...

这有什么错我的代码?

回答

1

您的Redirect正在进入循环。

做到这一点,而不是在.htaccess文件DocumentRoot或您的virtualhost部分。

RewriteEngine on 
RewriteCond %{REQUEST_URI} ^/$ [NC] 
RewriteRule^/em.php [L,R=301]