PPT下载网 - www.xiazaii.com - PPT背景图片,PPT模板免费下载!
首页 > 教程 > 服务器教程 > apache下http跳转到https伪静态规则,设置排除路径目录不跳转到https

apache下http跳转到https伪静态规则,设置排除路径目录不跳转到https

时间:2020-09-02来源:xiazaii.com 作者:天下 点击: 60 次



在做站过程中老是遇到这种那种的问题,现在ssl https已经是趋势所需,所以准备将自己的站升级成https,在设置过程中难免有需要将一些路径不跳转到https,研究了半天,apache伪静态Http跳转到https规则如下:

RewriteEngine On 
RewriteBase / 
RewriteCond %{HTTP_HOST} ^xiazaii.com [NC]
RewriteRule ^(.*)$ https://www.xiazaii.com/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 80
RewriteCond $1 !^(e|otherThings)
RewriteRule ^(.*)$ https://www.xiazaii.com/$1 [L,R=301]


其中:
RewriteCond %{HTTP_HOST} ^xiazaii.com [NC]
RewriteRule ^(.*)$ https://www.xiazaii.com/$1 [L,R=301]
这一段是将不带w的域名301跳转到带w的https

这一段是将80端口全部跳转到https的域名,其中根目录下的 e|otherThings 这三个路径即/e  /otherThings排除掉不跳转。
RewriteCond %{SERVER_PORT} 80
RewriteCond $1 !^(e|otherThings)
RewriteRule ^(.*)$ https://www.xiazaii.com/$1 [L,R=301]


需要的同学拿走,不明白Q我,408180

转载务必注明出处!本文地址:https://www.xiazaii.com/article/383.html

最新内容