2013-02-21 71 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