2013-02-21 117 views
1

我創建了以下條件:htaccess的HTTPS關閉狀態

DirectoryIndex index.php 
RewriteEngine on 

RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} !^/(shop|delivery-checkout|delivery-order|delivery-offer|confirm-sms-code|show-delivery-product|auto-search-product|add-product|update-product|remove-product|destroy-cart|get-cart|cuisine|og-shop) [NC] 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 

RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/ [R=301,L] 

RewriteCond $1 !^(index\.php|robots\.txt|website|shop_files|shop_list|client|favicon\.ico|style\.css|sitemap.xml) 
RewriteRule ^(.*)$ ./index.php?/$1 [L] 

AddCharset utf-8 .js 

什麼我基本上是試圖做的是檢查(HTTPS)沒有出現在URL。
所以除了網址簡稱,它重寫https://www.

注意:我加載這些網址:domain.com/shop,domain.com/delivery-checkout,domain.com/delivery-order內的iframe,這就是爲什麼我想要排除和安全或不依賴於父站點的原因。

我在做什麼錯?

回答

1

這一變化代碼:

RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} !^/(shop|delivery-checkout|delivery-order) [NC] 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 
+0

我仍然得到了iframe中一個空白頁。如果我通過這些線路工作正常。此外,商店的uri可以是這樣的:domain.com/shop/1123441241。我不知道這是否值得一提。 – mallix 2013-02-21 19:53:56

+0

這個URL不可訪問。它正在加載一個iframe。因此,如果iframe具有https,則會使用https加載。如果iframe包含http,則會使用http加載。現在使用你的條件,它給了一個空白頁。所以這個想法是用https加載每個頁面,除了提到的網址(商店,送貨結帳,...,...),如果https關閉。 – mallix 2013-02-21 21:06:57

+0

剛剛測試過,它變成了https。 – mallix 2013-02-22 07:05:53