0

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

2
  • 2
    what web server are you using?
    – JP19
    Jan 18, 2011 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. Jan 18, 2011 at 12:29

2 Answers 2

1

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

0
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.

You must log in to answer this question.