📜  htaccess 将非 www 重定向到 www https - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:51.303000             🧑  作者: Mango

代码示例1
# Redirect to HTTP non-www to HTTPS www htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]