apache将某些URL重写为http而不是https

apache将某些URL重写为http而不是https,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,之前的一个问题是,我在哪里需要重写URL,比如 http://example.com/index.php?cPath=371_1659_1660&main_page=products_categories 到 我用这个来修好它 RewriteCond %{QUERY_STRING} ^(.)(^|&)main_page=products_categories(.)$ RewriteRule ^(.*)$ /$1?%1%3 [R=301,L] 我还发现我也有与https相同的U

之前的一个问题是,我在哪里需要重写URL,比如

http://example.com/index.php?cPath=371_1659_1660&main_page=products_categories

我用这个来修好它

RewriteCond %{QUERY_STRING} ^(.)(^|&)main_page=products_categories(.)$
RewriteRule ^(.*)$ /$1?%1%3 [R=301,L]
我还发现我也有与https相同的URL,所以

https://example.com/index.php?cPath=371_1659_1660&main_page=products_categories

你给了我重复的惩罚

是否可以修改我的重写规则,使其在删除重写规则的同时重定向到http页面

&main_page=products_categories 
后缀使

https://example.com/index.php?cPath=371_1659_1660&main_page=products_categories
将成为

http://example.com/index.php?cPath=371_1659_1660

不知道为什么这个问题被不公平地否决了

您可以使用此单一规则将两个URL重定向到
http://...

RewriteEngine On

RewriteCond %{QUERY_STRING} (?:^|&)main_page=products_categories(?:&|$) [NC]
RewriteCond %{QUERY_STRING} (?:^|&)(cPath=[^&]+) [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI}?%1 [R=301,L,NE]

为什么要投否决票?这个问题是明确和简洁的例子,什么是必需的,我做了什么,到目前为止!工作得很好。非常感谢。
http://example.com/index.php?cPath=371_1659_1660
RewriteEngine On

RewriteCond %{QUERY_STRING} (?:^|&)main_page=products_categories(?:&|$) [NC]
RewriteCond %{QUERY_STRING} (?:^|&)(cPath=[^&]+) [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI}?%1 [R=301,L,NE]