Can I deny / ban an IP address from accessing my website?

Question:

I have collected the IP addresses of some people who have been causing problems on my website. Would you be able to tell me if they use dynamic or static IPs? Is there are way to block these IP addresses to my site?

Answer:

Hi,

There is no quick and easy way to tell if they are using dynamic or static IPs. You can research each IP and sometimes get an idea from the reverse lookup name. Even then it can be hard to tell.

Blocking, banning, etc. the IPs is easy though.

Here is how to block them from your site :

Create a file called

.htaccess

(that is dot htaccess – the file begins with a dot)

If you are having a hard time creating a file that starts with a dot, you can create the file as any filename, upload it to your server and then rename it in FTP to be .htaccess. The file will only work if it is called .htaccess (dot htaccess).

Inside the .htaccess file put these lines:

Order Allow,Deny
Deny from 192.168.1.10
Allow from all

Replace the address above (192.168.1.10) with the actual address you are wanting to ban.

Next add a seperate :

Deny from

line for each IP you want to deny.

If you want to block a range of IPs you can do this :

Deny from 192.168.1.

which would block everything in the 192.168.1.x range. For example:

192.168.1.1
192.168.1.2
etc.

I hope this helps you!

Leave a Reply

Your email address will not be published. Required fields are marked *