15.Linux Centos7 apache2.4 HTTP强制跳转HTTPS

 配置,有两种方式配置
1)在 <\VirtualHost *:80><\VirtualHost> 标签内随便一个地方加入以下三行
    RewriteEngine on
    RewriteCond   %{HTTPS} !=on
    RewriteRule   ^(.*)  https://%{SERVER_NAME}$1 [L,R]


2)网站目录处新建.htaccess 输入
    RewriteEngine on
    RewriteBase / 
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^.* https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

猜你喜欢

转载自blog.csdn.net/weixin_42135441/article/details/82743921
今日推荐