Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess https到http,用于使用htaccess的某些URL_.htaccess_Http_Ssl_Https - Fatal编程技术网

.htaccess https到http,用于使用htaccess的某些URL

.htaccess https到http,用于使用htaccess的某些URL,.htaccess,http,ssl,https,.htaccess,Http,Ssl,Https,我尝试了一些我在一些问题答案上找到的代码提示,但我没有任何运气 所以我把它作为我的问题 我想将一些URL的表单https重定向到http 我的htaccess代码的一部分如下所示。但这不起作用,URL仍然保留在SSL上。 主SSL direct来自服务器 RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{HTTPS}

我尝试了一些我在一些问题答案上找到的代码提示,但我没有任何运气

所以我把它作为我的问题

我想将一些URL的表单https重定向到http

我的htaccess代码的一部分如下所示。但这不起作用,URL仍然保留在SSL上。 主SSL direct来自服务器

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的代码片段解决我的问题。但我一点运气都没有。它仍然保持在SSL上。这可能是因为SSL来自Apache服务器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 /

提前谢谢你的帮助。关于

除了一件事,你的规则似乎很好。查询字符串不包括在
重写规则的第一个参数中,或者可以与
%{REQUEST\u URI}
匹配。此外,regex中的
字符表示“匹配前一个字符0或1次”,而
字符表示“匹配任何字符”。您需要将它与
%{QUERY\u STRING}
%{THE\u REQUEST}
匹配

您可以通过将公共部分(
index.php
)移动到重写规则的第一个参数来简化它,在描述每个可能的查询字符串的所有条件之前打开所需的HTTPS。通过将这些条件与或标志链接,只要其中一个为真,则其中只有一个必须为真

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} ^lang=de&Itemid=231$ [OR]
RewriteCond %{QUERY_STRING} ^lang=en&Itemid=337$ [OR]
RewriteCond %{QUERY_STRING} ^lang=fr&Itemid=338$ [OR]
RewriteCond %{QUERY_STRING} ^option=com_content&view=category&layout=blog&id=58&Itemid=231&lang=de$ [OR]
RewriteCond %{QUERY_STRING} ^option=com_content&view=category&layout=blog&id=58&Itemid=337&lang=en$ [OR]
RewriteCond %{QUERY_STRING} ^option=com_content&view=category&layout=blog&id=58&Itemid=338&lang=fr$
RewriteRule ^index\.php$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

嗨,Sumurai8,感谢到目前为止的回复和帮助。但我仍然对这个问题持保留态度。也许你可以在我上面的回答中找到问题所在。嗨,StackOverflow不是一个论坛。因此,你不应该对我的回答发表“回复”,作为对你问题的回答,除非它确实解决了你问题中概述的问题。您可以更好地用新信息编辑您的问题,并像这里一样用注释通知我。@konzeptplus您的.htaccess在哪里,它是否包含更多规则?那么它包含什么规则呢?嗨@Sumurai8。谢谢你迄今为止的帮助。对于第二个合理的答案,我很抱歉。我没有意识到这一点。现在我明白了。我在我的第二个“答案”中更新了一些信息。提前谢谢。htaccess位于根目录上,孔代码位于secound应答更新中。谢谢Sumurai8,关于它的所有问题和更新现在都在1个问题中。可能是因为必须转换为http的url在registerd区域中,所以无法工作?和/或因为SSL也被cms配置推送?