简体   繁体   English

从https重定向到http几页htaccess

[英]Redirect to http from https for a few pages htaccess

I've following code in my htaceess: 我在htaceess中遵循以下代码:

RewriteRule ^productdetails/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+) /singlepro.php?cat=$1&sub=$2&fur=$3&name=$4&data=$5/

What happens is, if a person is already on https page, the above code redirects to https version. 发生的情况是,如果某个人已经在https页面上,则上面的代码将重定向到https版本。 If I write the following code: 如果我编写以下代码:

RewriteRule ^productdetails/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+) http://www.example.com/singlepro.php?cat=$1&sub=$2&fur=$3&name=$4&data=$5/

It shows URL as http://www.example.com/singlepro.php?cat=aaa&sub=aaa&fur=aaa&name=aaa&data=aaa/ . 它将URL显示为http://www.example.com/singlepro.php?cat=aaa&sub=aaa&fur=aaa&name=aaa&data=aaa/ I want to redirect to http plus it should show URL as /productdetails/../../.. Any idea what can be done? 我想重定向到http,并且应该将URL显示为/productdetails/../../ ..知道该怎么办吗?

htaccess file htaccess文件

RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteCond %{HTTPS} off
RewriteRule (.*) http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^xyz\.php$ https://www.example.com/xyz.php [L,R=301]
RewriteRule ^productdetails/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)
            /singlepro.php?cat=$1&sub=$2&fur=$3&name=$4&data=$5/

For some of the pages like xyz.php, I redirect them to https. 对于某些页面,例如xyz.php,我将其重定向到https。

If i understand well. 如果我理解得很好。 Add on top of your .htaccess : .htaccess顶部添加:

RewriteCond %{HTTPS} on
RewriteRule ^productdetails/ http://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM