How do I setup any URL/URI for


to end up at the corresponding:


I'm guessing that the solution (if there is one), will involve DNS settings and .htaccess voodoo. But I don't really understand how those things work (particularly .htaccess). So, some specific suggestions on what to read would also be appreciated. (Yes, I can google, but this seems to be a rather specific and/or esoteric question, and I have been unsuccessful in effecting a solution. Or, I could be stupid...)


I have domains example.net/.org/.com all registered with the same registrar. Via the registrar's domain settings, I have example.net and .org setup to redirect (301) to example.com. I have example.com hosted at a separate shared hosting company that uses Apache & cPanel.

Currently, some redirects work: http://(with or without www).example.(net/org) => http://example.com.

However, http://www.example.com does not redirect to just http://example.com.

Now for the tricky part. The web host also has "SNI based SSL". So, https://exmple.com and https://www.example.com both work, but, with https, the www URL does not redirect to the base domain (https://example.com).

Additionally, https://example.net does not work either, with or without the www (won't connect/times out).

So, in short (too late??), if possible, how do I configure all permutations of the above to end up at the corresponding:


Or, if the answer would require the completion of a doctoral thesis to implement, what is a common/reasonable setup?


1 Answer 1


Additionally, https://example.net does not work either, with or without the www (won't connect/times out).

For .net and .org to work on HTTPS you need to have SSL certs that cover these domains (as you do already for the .com) - "SNI based SSL" is fine. However, in order to do this, you probably need to have the DNS for these domains pointing to the same server (your hosting account) and these domains configured as "Alias" (or "Parked") domains within your cPanel account. ie. Change the NAMESERVERS on these domains at your registrar, the same you have probably done for example.com. (That is unless your domain registrar can configure SSL for these domains and you can configure the appropriate redirect from that end - which I very much doubt.)

You can then issue ("Let's Encrypt"?) SSL certs that cover these additional domain names within cPanel.

Currently, you have redirects for .net and .org from your registrar, because the DNS is currently handled by your registrar. When you point the DNS to your webhost these redirects will naturally stop working.

And now for the .htaccess "voodoo" to redirect everything to your canonical host (example.com) and HTTPS. Actually, it's really not that bad, as far as redirects go.

At the top of the .htaccess file in the document root, add the following mod_rewrite directives:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com$ [OR]
RewriteCond %{HTTPS} !on
RewriteRule ^ https://example.com%{REQUEST_URI} [R=302,L]

The above states... if the requested Host is not example.com (the canonical host) or the request is not HTTPS (the desired scheme) then redirect to https://example.com/somepath.

Note, the above is a 302 (temporary) redirect. Change this to a 301 (permanent) only when you have confirmed it is working OK. 301s are cached hard by the browser (by default) so can make testing problematic.

  • While most of this works for me, as it turns out, my current host does not permit any domain parking, so I am unable to (as far as I can tell) effect the part about https://example.net => https://example.com. Sep 2, 2017 at 5:00

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.