【发布时间】:2014-03-15 00:38:28
【问题描述】:
我尝试了一些我在一些问题答案中找到的代码提示,但我没有任何运气。
所以我作为我的问题。
我想将一些 URL 的形式 https 重定向到 http。
我的 htaccess 代码的一部分如下。但它不起作用 URL 仍然停留在 SSL 上。 主要的 SSL 直接来自服务器。
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/index.php?lang=de&Itemid=231
RewriteCond %{REQUEST_URI} ^/index.php?lang=en&Itemid=337
RewriteCond %{REQUEST_URI} ^/index.php?lang=fr&Itemid=338
RewriteCond %{REQUEST_URI} ^/index.php?option=com_content&view=category&layout=blog&id=58&Itemid=231&lang=de
RewriteCond %{REQUEST_URI} ^/index.php?option=com_content&view=category&layout=blog&id=58&Itemid=337&lang=en
RewriteCond %{REQUEST_URI} ^/index.php?option=com_content&view=category&layout=blog&id=58&Itemid=338&lang=fr
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
提前感谢您的帮助。
我尝试使用 Sumurai8 的 code-sn-p 解决我的问题。但我没有运气。它仍然停留在 SSL 上。这可能是因为 SSL 来自 Apache-Server Confixx 配置吗?
我还检查了缓存。此外,我无法将您的代码与简化代码一起使用。它说,它无法完成请求 -> 循环。
查询字符串不包含在 RewriteRule 的第一个参数中,或者可以与 %{REQUEST_URI} 匹配
我需要添加新规则来匹配条件吗?
喜欢:
RewriteRule .* http://%{HTTP_HOST}%{QUERY_STRING} [R=301,L]
更新:
htaccess 文件位于 html 文件夹中。所以不在子文件夹中。
目前的坑代码如下:
Action php /cgi-php53/php
AddHandler php53 .php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} ^/index.php?lang=de&Itemid=231 [OR]
RewriteCond %{QUERY_STRING} ^/index.php?lang=en&Itemid=337 [OR]
RewriteCond %{QUERY_STRING} ^/index.php?lang=fr&Itemid=338 [OR]
RewriteCond %{QUERY_STRING} ^/index.php?option=com_content&view=category&layout=blog&id=58&Itemid=231&lang=de [OR]
RewriteCond %{QUERY_STRING} ^/index.php?option=com_content&view=category&layout=blog&id=58&Itemid=337&lang=en [OR]
RewriteCond %{QUERY_STRING} ^/index.php?option=com_content&view=category&layout=blog&id=58&Itemid=338&lang=fr
RewriteRule .* http://%{HTTP_HOST}%{QUERY_STRING} [R=301,L]
不活跃的条件和规则
#RewriteCond %{HTTP_HOST} ^chimia.ch
#RewriteRule (.*) http://scg.ch/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^myow.ch
#RewriteRule (.*) http://scg.ch/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^polycoll.ch
#RewriteRule (.*) http://scg.ch/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^swiss-chem-soc.ch
#RewriteRule (.*) http://scg.ch/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^youngchemists.ch
#RewriteRule (.*) http://scg.ch/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^www.chimia.ch
#RewriteRule (.*) http://scg.ch/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^www.myow.ch
#RewriteRule (.*) http://scg.ch/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^www.polycoll.ch
#RewriteRule (.*) http://scg.ch/$1 [R=301,L]
然后是一些重定向,例如:
Redirect /cours/2014-aa1f https://scg.ch/index.php?option=com_superevents&redirect=category&catid=74&Itemid=525&task=group&view=details&id=2674&lang=en
Redirect /cours/2014-aa2f https://scg.ch/index.php?option=com_superevents&redirect=category&catid=74&Itemid=525&task=group&view=details&id=2678&lang=en
Redirect /cours/2014-aa3f https://scg.ch/index.php?option=com_superevents&redirect=category&catid=74&Itemid=525&task=group&view=details&id=2689&lang=en
更多重定向
Redirect /roempp https://scg.ch/index.php?option=com_content&view=article&id=926:roempp-online-special-offer-for-scs-members&catid=9:scg-news&Itemid=112&lang=en
Redirect /login https://scg.ch/index.php?option=com_comprofiler&task=login&lang=en
ErrorDocument 404 /
提前感谢您提供更多帮助。问候
【问题讨论】: