我知道有很多關於我的問題的主題。我檢查了他們,並試用了它們,但無法使其工作。 我只需要在某些頁面上將http重寫爲https。訪問https頁面後,URL將返回到http。 這是我到目前爲止有:僅在使用.htaccess的某些頁面上將http重寫爲https
# Rewrite Rules for domain.com
RewriteEngine On
RewriteBase/
#Rewrite www to domain.com
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
#Rewrite to https
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /secure.php
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
#traffic to http://, except secure.php
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /secure.php
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
當我跳過了最後一組規則(流量爲http://,除了secure.php)的secure.php頁面加載的HTTPS和加密。精細。使用最後一組規則(到http://的流量,除secure.php之外),URL重寫爲https,變成藍色(SSL)一秒鐘後消失(無SSL),但URL仍然是https。
有什麼想法? Jacek
你的第三套RewriteCond和RewriteRule正如你在這裏所說的那樣,與第二套相同。 – 2011-11-19 03:20:14