htaccess https关闭条件

时间:2013-02-21 19:45:02

标签: .htaccess codeigniter codeigniter-2

我创建了以下条件:

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

我基本上要做的是检查URL中是否存在(https) 因此,除了引用的URL,请将其重写为https://www.

注意:我在iframe中加载这些网址: domain.com/shop,domain.com/delivery-checkout,domain.com/delivery-order 这就是为什么我希望那些被排除和安全的人取决于父网站。

我做错了什么?

1 个答案:

答案 0 :(得分:1)

使用以下代码更改您的代码:

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