【发布时间】:2014-12-28 11:37:04
【问题描述】:
我知道还有其他页面涵盖 https 到 http,但它们似乎都主要涵盖为整个网站做这件事。
基本上我想做的是....我们网站的一个部分通过https 提供服务,但在标题中它包含一个搜索字段,目前指向http,但是这会导致 Chrome 中出现 警告图标,因此我们需要将其更改为 https。
它指向的搜索页面未设置为通过 https 提供服务,因此我们只想将指向该页面的任何 https 请求重定向到等效的 http。
例如:
https://www.example.com/search.php
被重定向到:
http://www.example.com/search.php
...和:
https://www.example.com/search.php?term=foo&cat=bar
被重定向到:
http://www.example.com/search.php?term=foo&cat=bar
我正在阅读this page,但仍然不太确定如何正确操作。
另外,不是 100% 确定在我当前的 .htaccess 文件中放置它的位置,这是我们当前的文件:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteRule ^(.*),(.*)$ $2.php?rewrite_params=$1&page_url=$2
RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
RewriteRule ^stores/([0-9a-z.-]+)/?$ shop.php?shop_id=$1 [L,QSA,NC]
RewriteRule ^stores/([0-9a-z.-]+)/ajax_files/watch_item\.php$ ajax_files/watch_item.php [L,QSA,NC]
RewriteRule ^stores/([0-9a-z.-]+)/ajax_files/save_field\.php$ ajax_files/save_field.php [L,QSA,NC]
RewriteRule ^stores/([0-9a-z.-]+)/images/form-cb-icons\.png$ images/form-cb-icons.png [L,NC]
RewriteRule ^group-break/([0-9]+)/[0-9a-z.-]+/?$ group_break.php?cb_id=$1 [L,NC]
RewriteRule ^group-breaks/([a-z]+)-[a-z-]+/?$ group_breaks.php?tab=$1 [L,NC]
RewriteRule ^afltcc$ /register.php?partner_id=100 [L,NC]
可以放在任何地方吗?
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect rewrite