Knowledgebase: General QA
Banning IP Addresses Using .htaccess
Posted by Barry Tarbet on 10 April 2008 06:26 AM

Banning IP Addresses Using .htaccess

There may be times where you want to refuse access to certain robots or visitors to your web site.
You Must use a Html Text Editor, or the Control Panel File Manager / Edit option

> Step One
if using control panel File Manger, - make sure you enable "show hidden files"
locate or create the .htaccess file at the root ( directory, don't overwrite the existing file if one exists.

1. Basic .htaccess file

order allow,deny
deny from
allow from all

This will refuse all GET and POST requests made by IP address, an error message is shown instead.

2. More options

To block multiple IP addresses, list them one per line.

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

You can also block an entire IP block/range. Here we will not specify the last octet in the .htaccess file.

deny from 127.0.0

This will refuse access for any user with an address in the to range.

Instead of using numeric addresses, domain names (and subdomain names) can be used to ban users.

deny from

It bans users with a remote hostname ending in This would stop all users connected to the internet via from viewing your site.

Using .htaccess to block an entire range or name is likely to lock out innocent users. Use with caution.

thats it !

If you have any problems or questions , please dont hesitate to create a support ticket.

(187 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).