首页 > 技术文章 > centos下配置Apache的https强制跳转

echo-valley 2017-12-27 17:10 原文

vim /etc/httpd/conf/httpd.conf

新增如下三行

RewriteEngine on

RewriteCond  %{HTTPS} !=on

RewriteRule  ^(.*) https://%{SERVER_NAME}$1 [L,R]

 

重启Apache即可

systemctl restart  httpd.service

推荐阅读