Do you want to ban people from your website? Of course you can code this in PHP, but the most efficient way to do it, is to put it in the .htaccess file of your host. This way, you can also disable hotlinking of images or other files that are hosted on your website.

Keep your website yours, don't let it be taken over by useless spammers, bots and other annoying people.

Be careful when banning entire ranges of IPs, as you may also be blocking legitimate traffic!

User IP Ban

Valid entries:
IP-addresses should have this format:

xxx.xxx.xxx.xxx

, where "xxx" is a number between 0 and 255. In the .htaccess files you can specify a certain IP from your site, but you can also block full ranges.Examples:

42.13.6.32

Block the specific IP address

212.172.49.

Blocks all IP's from the range:

212.172.49.xxx

69.241.

Blocks all IP's from the range:

69.241.xxx.xxx

81.143.4

Blocks all IP's from the range:

81.143.4xx.xxx.xxx

To actually set the User IP Ban, put this code in your .htaccess file of your server (or create one of your own):

## USER IP BANNING
<Limit GET POST>
order allow,deny
deny from 42.13.6.32
deny from 212.172.49.
deny from 69.241.
deny from 81.143.4
allow from all
</Limit>

Site Referrer Ban

Example Valid entries:

somesite.com

Blocks traffic from somesite.com

somesite.

Blocks traffic from any site starting somesite.xxx, like somesite.com, somesite.net etc.

This (we)blog brings you information about (web)design, blogging tips, (programming) tutorials and much, much more. I can't describe Marcofolio.net in words: Just look around and be amazed. Many (new) visitors have a habit to stick around, just because of the variety of articles.

Have fun reading this blog and don't forget to subscribe to the feed to keep updated on the latest articles.