Apache .htaccess – Allow / Deny access from certain IPs

Tuesday, March 2, 2010 0:02
Posted in category Unix/Linux, Web

If  your website is under contruction and you want to allow access just to certain IP numbers, placing the following code in the .htaccess  file, in the website root directory, you can block access to everyone except the IP numbers you specify.

order deny,allow
deny from all
allow from
allow from
allow from

If you wish to deny access to specific IPs use the following code:

order allow,deny
deny from
deny from
allow from all

You can leave a response, or trackback from your own site.

Leave a Reply

Connect with Facebook