如何將http://secure.domain.com:444重定向到https://secure.domain.com:444?apache如何重定向到自定義端口的https協議?
我得到400(錯誤請求)錯誤,當我使用此代碼:
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>
如果您不使用單獨的端口號,Apache在端口連接時如何知道是否執行SSL協商? –
其實我是。 444端口啓用了SSL引擎。但是,如果我編寫http://,我只想重定向到https://。 –