AnOwnSite header

Use htaccess IP address block to get rid of stalkers or spammers


htaccess IP address blocks

It happens sometimes. You have a stalker or a spammer or anyone else causing you pain. You don't want that person to have access to your site anymore. That's what an htaccess IP address block can do for you.

And this is also very easy. All you have to do is add a couple of lines to your htaccess file like this one:
order allow,deny
deny from 123.45.6.7
deny from 012.34.5.
allow from all
That's all there is to it.
As you can see, the IP address can be a full address or just a part of it. That's useful, because most people on the Internet have an IP address that is dynamically generated at the time they connect. That's done by their ISP and every time they connect, they will have another IP address. In such cases it can be usefull to block the ISP.

Mind you, that there's also an option in Cpanel that does this. Don't overwrite any lines in your htaccess file by not downloading it first if you use Cpanel, or you may wipe IP blocking out.


Click to return to htaccess possibilities