rooger
rooger

Reputation: 135

restrict access to domain but allow access to subdomain

I have a domain name.com that points to IP 123.123.123.123 where I have installed a apache2 server.

I also have sub domains like ftp.name.com / etc.name.com that also point to the same ip address. I want that when a user types in browser name.com to be restricted access, like when the apache server is down (or like when you try to access a domain that does not exist) but in the same time I want the user to be able to access the sub domains. Does it make sense? Is it possible?

Upvotes: 0

Views: 940

Answers (1)

Andreas H.
Andreas H.

Reputation: 1811

"Like when the apache server is down" will not be possible because if it's down, it does not accept connections. But it will have to accept the connection to receive the HTTP header which tells the server the requested (sub)domain.

A possible solution would be to change your DNS entries. Let ftp.name.com point to your server (123.123.123.123 in your example) and configure www.name.com to an unused / invalid ip address. This way your ftp.name.com server will not receive name.com queries at all.

Upvotes: 1

Related Questions