繁体   English   中英

htaccess-仅将子域http重定向到https

[英]htaccess - redirect only sub domain http to https

我想使用一个子域下的.htaccess rewrite_mod仅页面将http重定向到https。

例如:仅针对此子域: http : //www.test.com/product/

http://www.test.com/product/good1/https://www.test.com/product/good1/

http://www.test.com/product/good2/https://www.test.com/product/good2/

问题是:可能吗? 如果是,请给我一个例子吗?

谢谢

试试这个规则

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} ^/product [NC]
RewriteRule ^ https://www.test.com%{REQUEST_URI} [R=301,L]

尝试这个,

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www.test.com$
RewriteCond %{REQUEST_URI} ^/product/(.*)$
RewriteRule ^(.*)$ https://www.test.com/$1 [L,R=301] 

暂无
暂无

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

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