I own two domain names:
- domain.com
- domain.net
…and I can't determine how to best setup the vhost code in order to achieve a few things:
- If a visitor types in either of those two domain names, they go to
domain.net
- If a visitor types in either of those two domain names with www in front, they still go to
domain.net
(without www) - Keep file paths in place, so:
domain.com/file.php
ends up going todomain.net/file.php
www.domain.com/deeper/path/
ends up going todomain.net/deeper/path/
www.domain.net
ends up going todomain.net
- …and so on
I saw, in this Q/A entry, what I believe is what I need, but I'm not 100% certain. Can somebody confirm (or correct) that this'll do exactly what I need:
<VirtualHost *:80>
ServerName domain.net
ServerAlias www.domain.net domain.com www.domain.com
(the rest of the settings here)
</VirtualHost>
…is it as simple as that?