2013-01-16 68 views
0

我在我的.htaccess文件中有幾個重定向指令,我將所有調用重定向到根文件夾到/ Site文件夾,它工作正常。使用.htaccess,如何強制HTTPS而不與其他RewriteRules衝突?

Options +FollowSymLinks 
RewriteEngine On 

# Redirect index in root to index in Site folder 
RewriteRule ^index\.php$ /Site/index.php [PT] 
RewriteCond %{REQUEST_URI} !^/Site 
RewriteRule ^(/?)(.*) /Site/$2 

我現在需要的是迫使HTTPS上的所有網頁,當我添加下面的指令,它沒有工作,我相信它進入一個無限循環:

#RewriteCond %{HTTPS} off 
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

什麼是正確的指示,使這項工作?

回答

0

我加入解決了這個問題後RewriteEngine敘述以下在

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

出於某種原因

#RewriteCond %{HTTPS} off 

沒有工作