Apache mod_rewrite to merge two domains to one SSL connection
I've got a client who recently changed their name. They had an SSL certificate for their site, and I was using mod_rewrite to ensure all requests to domain1.com and www.domain1.com went to https://domain1.com
.
Now that they are domain2.com, I'd like everything to go to https://domain2.com
. Not so easy, it turns out. I have everything working right except for requests to https://domain1.com
. That doesn't get rewritten and it trips the domain mismatch error for the SSL cert.
Here's my rewrite rules:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain2\.com$ [NC]
RewriteRule .? https://domain2.com%{REQUEST_URI} [R=301,L]
Any advice you could provide would be greatly appreciate开发者_Python百科d!
Aaron.
You need a SSL certificate including domain1.com and domain2.com (costs more).
精彩评论