繁体   English   中英

从https重定向到http几页htaccess

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

我在htaceess中遵循以下代码:

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

发生的情况是,如果某个人已经在https页面上,则上面的代码将重定向到https版本。 如果我编写以下代码:

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

它将URL显示为http://www.example.com/singlepro.php?cat=aaa&sub=aaa&fur=aaa&name=aaa&data=aaa/ 我想重定向到http,并且应该将URL显示为/productdetails/../../ ..知道该怎么办吗?

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/

对于某些页面,例如xyz.php,我将其重定向到https。

如果我理解得很好。 .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