开发者

Apache mod_rewrite to merge two domains to one SSL connection

开发者 https://www.devze.com 2022-12-18 13:49 出处:网络
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://do

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号