2012-09-05 59 views
0


我一直在过去2个月面临这个问题。
我有一个htaccess文件,我把它放在顶级主机目录中。
但是,只要我把它,它会导致重定向无限循环。
托管公司询问我是否启用了任何其他htaccess文件。
但我在整个托管目录中只有1个htaccess文件。
htaccess无限重定向循环

这里是我的.htaccess

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} 
</IfModule> 

谁能猜出无限循环的原因的代码?

回答

0

尝试:

RewriteEngine on 
#RewriteCond %{HTTPS} !=on 
#RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] 
0

你可以试试这个:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_URI} !^/index\. 
RewriteCond %{REQUEST_URI} !^/$ 
RewriteCond %{HTTPS} off 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} 
</IfModule> 

与将URI相匹配的第二条规则总是非空,/不会再次得到匹配,并继续循环。