1

we have a website with 2 different domains:

www.example.com or example.com

and www.example.com.ar or example.com.ar

I want all requests redirected to www.example.com.

I know I have to create two virtual hosts in Apache and in the .htaccess file for .com.ar site put the rewrite rule (as explained here I have domain.com and domain.org to the same site, should I use redirects to avoid duplicate content)

My question is: we have a wildcard SSL certificate for .com domain. Is it possible to redirect HTTPS requests for www.example.com.ar and example.com.ar to the .com site? Or I should get another SSL certificate for .com.ar domain?

1
  • Although it is a bit of work to set up, you can use CloudFlare to redirect your alternate domain with HTTPS for free. I've started using them for some of my alternate domains because it is easier than obtaining and managing the certificates on my own. See these instructions Commented Aug 19, 2020 at 0:38

1 Answer 1

1

Is it possible to redirect HTTPS requests for www.example.com.ar and example.com.ar to .com site? Or I should get another SSL certificate for .com.ar domain?

You'll need an SSL cert that covers .com.ar.

I know I have to create two virtual hosts in apache and in the htaccess file for .com.ar site put the rewrite rule

If you are creating virtual hosts then you don't need .htaccess or any "rewrite rule". The simpler mod_alias Redirect is all that's required. (Preferably, you'll use four virtual hosts - one for each hostname.)

2
  • One could use fewer than four virtual hosts with ServerAlias and SAN certificates. If you could get a SAN cert that covered all the alternate domains and subdomains, the redirects could easily be done in a single virtual host. Commented Aug 19, 2020 at 0:43
  • @StephenOstermiller Yes, you could and that may indeed be preferable in some cases. However, I was suggesting multiple vHosts to avoid mod_rewrite (and easier implementation of HSTS) - which would generally be considered simpler and more performant.
    – MrWhite
    Commented Aug 22, 2020 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.