How to Block an IP from Accessing Your Website
Posted on : 12-07-2010 | By : rituraj | In : Domains, General, security
0
Some days before i was checking logs of one of my website related to travel and i found that an IP was sucking a lot of bandwidth from my hosting account. But the website (the IP) was not sending any visitor to my website. I got confused as what was happening, so i checked the website and found that they were leeching one of my video, using an iframe.
Means they were presenting my video to their visitors, opening directly from my website using an iframe.
In one way it was good for me because the video was watermarked with my website name, so my website was getting extra exposure. But my main concern was the amount of bandwidth they were leeching.
So i emailed them to either remove my video from their website or host it on their own server, but i haven’t got any reply from them…
So i have banned their IP from accessing my website.
I wrote this post because i though many of you would have faced this problem, or may face in future. So what to do in such a situation?
There are probably two easy solutions for this, which are as follows:
1. Use free video hosting websites: You can use free video hosting websites like youtube.com for hosting your video. Once you have uploaded your video on youtube.com, you can embed them anywhere on your website, without worrying about bandwidth consumption.
2. Permanently Ban the IP or Website from Accessing your website: You can permanently ban any IP or website from accessing your website with the help of HTACCESS file.
Example: If you know the IP address (For an example we take this case, suppose it is 192.129.0.1) write
order allow, deny
deny from 192.129.0.1
allow from all
If you want to block multiple IP address using .htaccess simply add one IP address per line as below:-
order allow, deny
deny from 192.129.0.1
deny from 192.129.0.2
deny from 192.129.0.3
allow from all
You can even block a network range IPs using .htaccess:-
order allow, deny
deny from 192.0.0
allow from all
You can also use the name of the website like:
order allow, deny
deny from website URL(”website.com”)
allow from all
If you are using wordpress blogs there is a good plug-in available for blocking IP Addresses
Like: WP-Ban
If you are not familiar with HTACCESS File, let me show you how to make one
1. Open notepad
2. Write the code which you want to write in the HTACCESS (As shown in examples above)
3. Click Save As and type .htaccess in file name and choose Save As Type as All Files.
Next upload the file to the root folder of your website and you are done.
If you are getting any problem and need any help, please post in comments and i will try to help you out. Your suggestions are also welcome
Popularity: 13% [?]








![[Connotea]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/connotea.png)
![[del.icio.us]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/digg.png)
![[diigo]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/diigo.png)
![[Facebook]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/facebook.png)
![[Fark]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/fark.png)
![[Faves]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/faves.png)
![[LinkedIn]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/linkedin.png)
![[Netvouz]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/netvouz.png)
![[Reddit]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/reddit.png)
![[Squidoo]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/squidoo.png)
![[StumbleUpon]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/twitter.png)
![[Yahoo!]](http://www.riturajmishra.com/wp-content/plugins/bookmarkify/yahoo.png)
