I would like to know how to configure my VPS so that it's only accessible using sub.domain.com
, and not domain.com
. Anyone know how to do this?
Asked
Active
Viewed 202 times
1

Cooper Maruyama
- 113
- 4
2 Answers
1
Point the domain.com A record else where and the www. at your servers IP address.
A better option would be to 301 redirect the domain.com to the sub.domain.com so if a user types in domain.com it shows as sub.domain.com

KJS
- 186
- 2
-
the reason I'm doing this is so that clients who I build sites for cannot see the sites until they are final. therefore, I cannot have domain.com simply redirect to sub.domain.com - i need domain.com to show a 'page not found', while i test using something like test.domain.com – Cooper Maruyama Nov 02 '12 at 19:27
0
SImple: do not define an IP address for domain.com, only one for sub.domain.com.

bortzmeyer
- 3,941
- 1
- 21
- 24
-
this didnt work - i think vhost config needs to be adjusted. I tried changing `ServerName domain.com` to `ServerName sub.domain.com` which also did not work. – Cooper Maruyama Nov 02 '12 at 21:37
-
It does work. You *also* need to change the ServerName but the right thing to do is to have no address record for domain.com in the DNS. So, two things to adjust. – bortzmeyer Nov 02 '12 at 21:59