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

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.
WWW.fun.com - allow
http://172.20.145.78 - don allow.

Please help

share|improve this question

migrated from webmasters.stackexchange.com Jan 18 '11 at 12:52

This question came from our site for pro webmasters.

2  
what web server are you using? – JP19 Jan 18 '11 at 11:17
1  
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>
ServerName ip.add.re.ss
DocumentRoot /path/to/somewhere/else
<Directory /path/to/somewhere/else>
Order deny,allow
Deny from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName www.fun.com
ServerAlias fun.com *.fun.com
DocumentRoot /path/to/your/webroot
</VirtualHost>

That should do it.

share|improve this answer

Your Answer

 
discard

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