Wednesday, June 15, 2011

How to block or allow ips using .htaccess


Suppose you have a site and in the document root directory of you have a directory "admin" in which you want to restrict the access to others. But you want to give access to clients from some ips.

You can do this by creating a .htaccess file under "admin" directory.

.htaccess file can be like this.

Order Deny,Allow
Deny from all
Allow from IP_address1
Allow from IP_address2
Allow from IP_address3
Allow from IP_address4
Allow from IP_address5

thats it. will only be accessible to IP_address1-5

No comments:

Post a Comment

Be nice. That's all.