ppt免费下载网

展开

首页 > 教程 > 服务器教程
apache下http跳转到https伪静态规则,设置排除路径目录不跳转到https



在做站过程中老是遇到这种那种的问题,现在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

显示全部

标签

相关教程

举报