I have domain.io and domain.com BOTH pointing to the SAME server. How do I set this up so that domain.io never shows up in the address bar, and it's always domain.com?
Thanks!
I have domain.io and domain.com BOTH pointing to the SAME server. How do I set this up so that domain.io never shows up in the address bar, and it's always domain.com?
Thanks!
You can use Apache's mod_alias Redirect directive for this:
<VirtualHost *:80>
ServerName domain.io
ServerAlias www.domain.io
Redirect permanent / http://domain.com/
</VirtualHost>
In your case, permanent
(301) redirect sounds appropriate but you may want to look at HTTP redirect: 301 (permanent) vs. 302 (temporary)
Also, it's really unimportant where the domains are hosted in this case; they do not need to be on the same server. In fact, many DNS and web host providers actually provide this functionality as a service, and will host the equivalent of above configuration for you (though not necessarily with Apache; nginx is probably more likely for this purpose these days).