如何将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>