修改虚拟主机配置文件,添加如下跳转规则
<VirtualHost *:80> ServerName www.123admin.com ServerAlias 123admin.com RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=302,L] </VirtualHost>
规则说明:如果判断访问是80端口,就自动强制跳转到https协议访问。