Apache HTTPS从旧域redirect到新的HTTPS域
我曾经有一个曾经有一个SSL证书的域,它仍然有。 但是我已经更改了域名,并且我还为该新域名创build了一个新的SSL证书。 我仍然有用户通过https://shabbasheep.myolddomain.com访问该网站,它给了我This is probably not the site that you are looking for! 但是,当他们通过shabbasheep.myolddomain.com访问该网站时,它将它们正确地redirect到shabbasheep.mynewdomain.info 这里是我的apache条目的样子,从这里得到了一个想法 <VirtualHost *:80> ServerName shabbasheep.myolddomain.com RewriteEngine On RewriteCond %{HTTP_HOST} shabbasheep.myolddomain.com$ RewriteRule ^(/(.*))?$ https://shabbasheep.mynewdomain.info$1 [L,NC,R=301] </VirtualHost> 我的SSL <VirtualHost *:443> ServerName shabbasheep.mynewdomain.info ServerAlias www.mynewdomain.info RewriteEngine On RewriteCond %{HTTP_HOST} shabbasheep.myolddomain.com$ RewriteRule ^(/(.*))?$ https://shabbasheep.mynewdomain.info$1 [L,NC,R=301] SSLEngine on SSLCertificateFile "mypathto.crt" SSLCertificateKeyFile "mypathto.pem" SSLCACertificateFile "mypathto.crt" … … […]