Here's the environment:Apache, mod_rewrite.c existsWordPressTwo domains that point to the same webhost, we'll call themwww.olddomain.comwww.newdomain.comWe 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.comThen 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 -MultiViewsRewriteEngine on## if requested hostname is non-blankRewriteCond %{HTTP_HOST} .# and if requested hostname is NOT newdomain.comRewriteCond %{HTTP_HOST} !^www\.newdomain\.com# redirect to same object in correct domainRewriteRule (.*) https://www.newdomain.com/$1 [R=301,L]# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule># END WordPress##Block Spam ReferrerSetEnvIfNoCase Referer blackhatworth.com spam=yesSetEnvIfNoCase Referer priceg.com spam=yesOrder Allow,DenyAllow from allDeny from env=spam
How to 301 redirect old domain to new domain on same host with SSL and avoid Privacy Error
htaccess;redirects;https
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.