
我想確保在使用以下命令重定向 SSL VirtualHost 時不會出現任何神秘的奇怪行為模組別名 Redirect
作為Apache 在這裡概述了。
我的程式碼似乎可以工作,但由於 SSL 虛擬主機僅限於一個 IP 位址,因此我想確保沒有任何問題困擾我。明確不使用 TLS。我現在堅持使用 Apache 2.2。
<VirtualHost *:443>
ServerName example.com
SSLEngine On
SSLCertificateFile /path/to/example.com-crt.crt
SSLCertificateKeyFile /path/to/example.com-key.key
SSLCACertificateFile /path/to/example.com-ca.txt
Redirect 301 / https://www.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
SSLEngine On
SSLCertificateFile /path/to/example.com-crt.crt
SSLCertificateKeyFile /path/to/example.com-key.key
SSLCACertificateFile /path/to/example.com-ca.txt
# Do stuff
</VirtualHost>
所以我的問題是,帶有 mod_alias 的 SSL VirtualHost 重定向是否應該Redirect
與非 SSL 重定向一樣工作?
更新:需要明確的是,我想確保Redirect
規避對 SNI/TLS 的需求,尤其是與 WinXP 上的 IE6 相關的需求。在我在 WinXP-SP3 上使用 IE6 進行的測試中似乎工作正常(請參閱標記為正確的答案下面的評論)。
答案1
是的,它的工作原理是一樣的。
x509v3 包括主題別名。大多數(所有?)頒發 CA 都會將www.example.com
和列為example.com
所要求的憑證中的等效備用名稱。因此,在兩個 VirtualHost 實例中使用相同的憑證時,瀏覽器不會因名稱而阻塞。
另一方面,你有:
Redirect 301 / http://www.example.com/
我會推薦:
Redirect 301 / https://www.example.com/
因為這是畢竟是 SSL。