[英]Redirect http://www. and http:// to https for both root and subdomain
[英]Redirect http to https for only www root and not subdirectories
我正在尝试将网站重定向到https。 我用了
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
我有www.example.com.au
并且这些重定向很好; 但是,我也有mobile.example.com.au
,我不想重定向。 如何重定向一个而不另一个?
只需添加另一个条件,以使该规则仅适用于主域:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com\.au$ [NC]
RewriteCond %{HTTPS} !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.