2013-02-23 46 views
1

我有一個問題,隻影響谷歌瀏覽器。我有兩個子目錄secure.fixnode.ca和storage.fixnode.ca,這兩個索引都需要使用https協議。Google Chrome和apache .htaccess重定向循環錯誤

我在谷歌瀏覽器得到的錯誤是:「重定向循環錯誤,過多的重定向」

storage.fixnode.ca在谷歌瀏覽器的工作原理確定,但由於某些原因secure.fixnode.ca纔不是。

另外BOTH子目錄在每個其他瀏覽器(IE,FF,Safari)中都很出色。下面

是我的.htaccess文件:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^fixnode\.ca$ [NC] 
RewriteRule ^.*$ http://www.fixnode.ca%{REQUEST_URI} [R=permanent,L] 

RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^(secure|storage)\. [NC] 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 

# END OF CHANGE 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^([^\.]+)/$ $1.php 

ErrorDocument 401 /?loc=401error.php 
ErrorDocument 404 /?loc=404error.php 

Options -Indexes 

是giveing我的麻煩該生產線是:

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 

看來,谷歌瀏覽器看到的Apache HTTPS重定向功能的重定向錯誤。

沒有人知道我是否可以在谷歌瀏覽器和其他瀏覽器中以其他方式執行此操作?

任何幫助表示讚賞

感謝, 菲利普ķ

回答

1

從你的情況來看,似乎你的HTTPS重定向進入一個無限重定向循環。我有理由相信%{HTTPS}變量不是很穩定,應該是(我見過其他人有這個問題)。

嘗試從改變%{HTTPS}條件:

RewriteCond %{HTTPS} off 

到:

# If not port 443 (https) then this condition should match 
RewriteCond %{SERVER_PORT} !^443$ 

Alernatives是:

RewriteCond %{SERVER_PORT} ^80$ 

和..

RewriteCond %{REQUEST_SCHEME} ^http$ 
+0

對不起使用了錯誤的端口號,更新了答案 – kjetilh 2013-02-23 10:47:24

+0

GENIUS !,謝謝! – fixnode 2013-02-23 15:53:08

+0

好的,工作正常。但依靠港口或請求計劃有多安全? – johjoh 2013-12-05 14:32:28