1. 程式人生 > >15.Linux Centos7 apache2.4 HTTP強制跳轉HTTPS

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]