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]

你可能感兴趣的:(PHP,Linux)