更新时间:2023-09-12 08:41:34
尝试一下:
将www重定向到非www(使用SSL时)
To redirect www to non-www (while using SSL)
RewriteCond %{HTTP_HOST} ^www.your_domain.com$
RewriteCond %{SERVER_PORT} ^443
RewriteRule ^(.*)$ https://your_domain.com/$1 [R=301]
最后2个用于使用SSL或防止在某些页面上使用SSL时出现任何SSL错误。
The last 2 are meant for online stores using SSL or to prevent any SSL errors while using SSL on some pages.
Update1:
Update1:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{ENV:HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301,NE]
更新2
在
上使用RewriteEngine使所有http使用https:
RewriteEngine On Make all http use https:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://xxx.yyy/$1 [L,R=301]
仅使www https使用非www https:
Make only www https use the non-www https:
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^www[.].+$
RewriteRule ^(.*)$ https://xxxx.yyy/$1 [L,R=301]
更新3:
在此处查看此问题: