美文网首页
Apache的HTTP请求自动跳转HTTPS请求

Apache的HTTP请求自动跳转HTTPS请求

作者: Roy_Liang | 来源:发表于2017-06-14 17:46 被阅读416次

1.前往/etc/apache2/目录,打开httpd.conf文件

2.将文件中有关rewrite的注释去掉

3.文件中在Directory里, 注释掉AllowOverride none,改成AllowOverride All
并添加

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI}

4.重启Apache

sudo apachectl restart

测试~

自动跳转https


相关文章

网友评论

      本文标题:Apache的HTTP请求自动跳转HTTPS请求

      本文链接:https://www.haomeiwen.com/subject/iqkeqxtx.html