apache http自动跳转https
vim /etc/httpd/conf/httpd.conf
<Directory />
# AllowOverride none
AllowOverride All
Require all denied
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI}
</Directory>
说明:
RewriteEngine on:
开启重写
RewriteCond "%{SERVER_PORT}" !^443$:
端口不是443(%{SERVER_PORT}:访问的端口)
RewriteRule "^/?(.*)" "https://%{SERVER_NAME}%{REQUEST_URI}" [L,R,NE]:
重定向到https(%{SERVER_NAME}%:访问的域名,%{REQUEST_URI}:请求的URI)