问题原文
原帖链接 · Will Lanni · CC BY-SA 3.0
Here's the environment:
- Apache, mod_rewrite.c exists
- WordPress
- Two domains that point to the same webhost, we'll call them
- www.olddomain.com
- www.newdomain.com
We have an SSL Certificate for www.newdomain.com, but not www.olddomain.com, as per the rules about needing two separate IPs for separate SSL certificates.
My current .htaccess file works great EXCEPT when you type in
**https**://www.olddomain.com
Then the browser throws a Privacy Error "Your connection is not private" type page.
Here's what the .htaccess looks like:
Please note that the WordPress section and the Spam Referrer section probably have nothing to do with this, but I'm including them in case they're causing problems:
Options +FollowSymLinks -MultiViews
RewriteEngine on
#
# if requested hostname is non-blank
RewriteCond %{HTTP_HOST} .
# and if requested hostname is NOT "newdomain.com"
RewriteCond %{HTTP_HOST} !^www\.newdomain\.com
# redirect to same object in correct domain
RewriteRule (.*) https://www.newdomain.com/$1 [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
##Block Spam Referrer
SetEnvIfNoCase Referer blackhatworth.com spam=yes
SetEnvIfNoCase Referer priceg.com spam=yes
Order Allow,Deny
Allow from all
Deny from env=spam
已采纳解答
原帖链接 · dartonw · CC BY-SA 3.0
While it isn't impossible to host multiple secure sites on a single IP address, thanks to SNI and SAN, the redirect you're trying to do is impossible without one of the aforementioned solutions. In order to receive a redirect from https://www.olddomain.com, the browser must have already requested that URL using SSL/TLS, and is expecting an encrypted response from the web server with a valid certificate for that domain - even if that response is only a 301.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
