设置方法
下面规则中蜗牛使用的域名是www.wn789.com或wn789.com,使用时请根据自己需要更改为自己的域名。至于规则放置到什么位置,一般我们可以选择放到到apache的conf配置文件对应位置,或指定站点目录 .htaccess 文件内容的头部。 1、强制HTTPS方式访问,对WWW或顶级域名不做跳转。RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.wn789.com/$1 [L,R=301]
2、强制HTTPS方式访问,并自动将顶级域名跳转到WWW。
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.wn789.com$ [NC]
RewriteRule ^(.*)$ https://www.wn789.com/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.wn789.com/$1 [L,R=301]
3、强制HTTPS方式访问,并自动将WWW跳转到顶级域名。
RewriteEngine On
RewriteCond %{HTTP_HOST} !^wn789.com$ [NC]
RewriteRule ^(.*)$ https://wn789.com/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://wn789.com/$1 [L,R=301]
赞(0)


