Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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.