1

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?

2 Answers 2

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

1
  • 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 Nov 2, 2012 at 19:27
0

SImple: do not define an IP address for domain.com, only one for sub.domain.com.

2
  • 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. Nov 2, 2012 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 2, 2012 at 21:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .