Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to restrict users to go to my site only by using the domain name not by the IP address.

example. - allow - don allow.

Please help

share|improve this question

migrated from Jan 18 '11 at 12:52

This question came from our site for pro webmasters.

what web server are you using? – JP19 Jan 18 '11 at 11:17
Since this is a web server configuration issue, it should probably be posted on serverfault. Also, the "accessibility" tag is a bit misleading here. – Lèse majesté Jan 18 '11 at 12:29

Set a virtualhost name-based. If you are using apache, read this.

share|improve this answer
NameVirtualHost *:80

<VirtualHost _default_:80>
DocumentRoot /path/to/somewhere/else
<Directory /path/to/somewhere/else>
Order deny,allow
Deny from all

<VirtualHost *:80>
ServerAlias *
DocumentRoot /path/to/your/webroot

That should do it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.