2017-09-25 66 views
0

如果URL中存在https,我无法从一个域重定向到另一个域。错误使用https重定向域到另一个域

也就是说,我必须处理上必须reindered域https://www.mywebsite2.com

有了这个,我用这个代码,安全地管理它通过htaccess的域http://www.mywebsite1.net提出的所有要求:

RewriteEngine on 
RewriteRule ^(.*)$ https://www.mywebsite2.com/$1 [R=301,L] 

问题是,如果一个网址与此https://www.mywebsite1.net错误页面

NET :: ERR_CERT_COMMON_NAME_INVALID 

到达,因为SSL证书不使用L onger安装在旧域中。那么我该如何处理这个问题呢?

我希望我已经够清楚了。 谢谢

回答

0

查看SNI,服务器名称指示。根据您选择浏览器是否支持它,你可以创建虚拟主机的需求(详见:https://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI

# Ensure that Apache listens on port 443 
    Listen 443 

    # Listen for virtual host requests on all IP addresses 
    NameVirtualHost *:443 

    # Go ahead and accept connections for these vhosts 
    # from non-SNI clients 
    SSLStrictSNIVHostCheck off 

    <VirtualHost *:443> 
     # Because this virtual host is defined first, it will 
     # be used as the default if the hostname is not received 
     # in the SSL handshake, e.g. if the browser doesn't support 
     # SNI. 
     DocumentRoot /www/example1 
     ServerName www.mywebsite1.net 

     # Other directives here 

    </VirtualHost> 

    <VirtualHost *:443> 
     DocumentRoot /www/example2 
     ServerName www.mywebsite2.com 

     # Other directives here 

    </VirtualHost> 

所有现代浏览器都支持此功能。如果他们不这样做,你就会被卡住,因为HTTP头部分已被加密,所以没有办法选择正确的虚拟主机。

相关问题