apache http跳转到https代码

<VirtualHost *:80>
    ServerAdmin webmasterexample.com
    DocumentRoot "/mnt/www/"
    ServerName www.test.com
    ServerAlias 

    #HTTP_TO_HTTPS_START
    #301-START
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{SERVER_PORT} 80
        RewriteRule ^(.*)$ https://www.test.com/$1 [R=301,L]
        
    </IfModule>
</VirtualHost>

 在你的网站配置文件*.conf 中修改

posted @ 2017-12-08 14:47  fogwu  阅读(2036)  评论(0编辑  收藏  举报