0

这是要添加到 httpd.conf 的配置,它从未测试过。

<VirtualHost facebook.domain.com:443>
    DocumentRoot "/var/www/html"
    ServerName domain.com
    ServerAlias facebook.domain.com
    ServerAdmin admin

    SSLEngine on

    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW
    :+SSLv2:+EXP:+eNULL

    SSLCertificateFile "/var/www/html/server.crt"

    SSLCertificateKeyFile "/var/www/html/server.key"

    <FilesMatch "\.(cgi|shtml|phtml|php|php5|php4|php3?)$">
       SSLOptions +StdEnvVars
    </FilesMatch>

    <Directory "path/to/cgi-bin">
       SSLOptions +StdEnvVars
    </Directory>
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
</VirtualHost>

但我想用户在浏览http://www.domain.com/index.php?op=facebook时会自动重定向到https://www.domain.com/index.php?op=facebookhttps:// /facebook.domain.com/index.php?op=facebook,如何实现?

谢谢

4

1 回答 1

1
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

这将重定向所有 http -> https 连接。您必须将其添加到 http (:80) 虚拟主机。

于 2012-05-09T07:38:26.687 回答