Set apache redirect from http to https
进入/etc/httpd/conf/目录:编辑httpd.conf:
键盘shift + g 跳至文件末尾:
添加如下语句:
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTPS} ^test.testserver.com$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
也可以试试:
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI}
</VirtualHost>
保存退出之后,
/etc/init.d/httpd restart
重启http server。
页:
[1]