在CentOS 7 配置 Apache HTTP Server 将 http 自动跳转为 https
        【摘要】 编辑httpd配置文件:[root@CentOS~]# vim /etc/httpd/conf/httpd.conf修改说明:找到下列内容:<Directory "/var/www">    AllowOverride None    # Allow open access:    Require all granted</Directory>修改为:<Directory "/var/www...
    
    
    
    - 编辑httpd配置文件: 
[root@CentOS~]# vim /etc/httpd/conf/httpd.conf - 修改说明:
找到下列内容:
修改为:<Directory "/var/www"> AllowOverride None # Allow open access: Require all granted </Directory><Directory "/var/www"> AllowOverride None # Allow open access: Require all granted RewriteEngine on RewriteCond "%{SERVER_PORT}" !^443$ RewriteRule "^/?(.*)" "https://%{SERVER_NAME}%{REQUEST_URI}" [L,R,NE] </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) 
 - RewriteEngine on:
 
        【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
            cloudbbs@huaweicloud.com
        
        
        
        
        
        
        - 点赞
 - 收藏
 - 关注作者
 
            
           
评论(0)