.htaccess重写循环错误

时间:2012-11-13 14:23:31

标签: .htaccess mod-rewrite rewrite

我需要能够做到这一点,以便当有人访问我的网站时说:

a)http://www.mysite.co.uk/

它实际上显示的内容来自:

b)http://www.mysite.co.uk/catalog/index.php

并且如果用户键入(b),那么他们对(a)

301

在我的.htaccess中,我目前有以下内容,但这会导致301循环错误

RewriteRule ^/?$ catalog/index.php [L]
Redirect 301 /catalog/index.php http://www.mysite.co.uk

有什么方法可以解决这个问题吗?感谢

1 个答案:

答案 0 :(得分:0)

尝试以下几行:

#Permanently redirect BROWSER requests for the .php script to the Site root:
RewriteCond %{THE_REQUEST}      /catalog/index.php     [NC]
RewriteRule ^.*                 http://%{HTTP_HOST}/   [R=301,L]

#Internal redirect (Alias) the root of the site to: /catalog/index.php
RewriteRule ^$                  /catalog/index.php      [L]