I have a bunch of domain names with different TLDs. What I want is to point several domains to the "main"-domain which has a SSL cert (single domain).
Like this:
https://example.com (main domain with SSL cert)
http://example.net (should redirect to https://example.com and rewrite the URLs)
http://example.org (should redirect to https://example.com and rewrite the URLs)
The https domain points to the directory which contains the website data. I created a subfolder in that directory where I pointed the additional domains to, because I was thinking I could place a htaccess file there to manage redirection and rewriting. Is that OK so far?
I am having trouble finding the correct htaccess rules which permanently redirect the requested domain (either example.net
or example.org
) to https://example.com
and rewrites the URLs correctly.
I tried the simplest thing that came to my mind:
Redirect permanent / https://example.com/
But that resulted in e.g. https://example.net
which, of course, does not work.
Edit:
I use WordPress and put https://example.com
as blog URL as well as site URL in the settings and I made WordPress force SSL.
Can someone please help?
http://additionaldomain
is not accessible over HTTPS? (You didn't need to use subdirectories if you simply wanted to redirect, you could just point these additional domains to the document root of the main domain.)htaccess
's would be my guess too. Both additional domains are not accessible via HTTPS since I only have a single domain SSL cert... which I used for the main domain. I surely could just point the additional domains to the correct directory but wouldn't that mean a user could also access the site via HTTP and wouldn't that result in duplicate content? I'm asking because I need every user to access the site via HTTPS.