1

如何将http://secure.domain.com:444重定向到https://secure.domain.com:444

使用此代码时出现 400 (Bad Request) 错误:

RewriteEngine
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

提前致谢。

编辑:

这是完整的配置:

    Listen 444
    NameVirtualHost ip:444

    <VirtualHost ip:444>
            ServerName secure.domain
            DocumentRoot "/var/www/.phpmyadmin/3.5.1/"

            RewriteEngine On
            RewriteCond %{HTTPS} !=on
            RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

            SSLEngine on
            SSLProtocol all -SSLv2
            SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM

            SSLCertificateFile /etc/httpd/conf/domain.crt
            SSLCertificateKeyFile /etc/httpd/conf/domain.pwdless.key
            SSLCertificateChainFile /etc/httpd/conf/sub.class1.server.ca.pem
            SSLCACertificateFile /etc/httpd/conf/ca.pem

            <Directory "/var/www/.phpmyadmin/3.5.1/">
                    Options None
                    AllowOverride None
                    Order allow,deny
                    Allow from all
                    AuthType Basic
                    AuthName "Restriected Access"
                    AuthUserFile "/var/www/.phpmyadmin/.access"
                    Require valid-user
            </Directory>
    </VirtualHost>

    <VirtualHost ip:444>
            ServerName domain
            ServerAlias *.domain
            RedirectMatch 404 ".*"
    </VirtualHost>
4

1 回答 1

0

这是不可能的。服务器设置为仅接受该端口上的 SSL 请求。有一个 RFC 可以支持您所要求的内容(RFC 2817),但普通浏览器不支持它。Chrome 错误跟踪器中的票证上有一些链接。

于 2012-05-27T00:10:26.337 回答