MyBestRatedWebHosting's MBRW Second Semi-Annual 2011 Hosting Award has been officially announced! Save yourself time and money by reading our detailed review and learn who received the final award of the industry's best web host!

Block an Unwanted IP from Accessing your Website

Block an Unwanted IP

It is an unfortunate fact of the internet that there are going to be some people whos actions will require a webmaster to ban them from a site. They could be spamming a forum, making disparaging comments or deliberately upsetting other site users – either way, they need to go to ensure that the site functions in a professional and worthwhile way. However, the problem is that stopping people from accessing your website isn’t simple a case of saying “sorry, you can’t come in.” Instead, it requires a more technical approach that many webmasters are not aware of.

How to Find an IP Address

The most common reason for blocking an IP from accessing a website is due to abuse of posting facilities, but this is quite an easy problem to solve. This is because every time someone makes a post, their IP information is included with the data that is sent over – similar in nature to when a phone number is displayed on a cell phone upon answering a call. This IP address is the crucial element to note down and once found, the rest is easy.

It must be noted that IP addresses do change sometimes, but the bulk of the address will remain the same. For example, one day you could get a spam comment from an IP address of, then another day from In this case it is obvious that one single address can’t be blocked. Luckily, it is possible to block all IP addresses that start with 192.168, therefore negating the problem once and for all.

Blocking the IP

Blocking an unwanted IP address from a website is done through the .htaccess file, which is found in the root directory of your website. In this file you can either type “Deny from” to block a single IP address, or alternatively you can type “Deny from 192.168.*”, which will deny all IP addresses starting with this sequence of numbers. After this has been saved, those that seek to destroy the good reputation of your website will no longer be able to access it from their usual IP address.

Unfortunately, many spammers do not use their own IP address and in fact hijack an IP address of an innocent and unknowing person. This means that if you block this address, you will also be blocking a completely innocent person. Therefore, if the spamming continues from a different IP then be sure to unblock the original one and allow that user back on to the system.

Related Articles

21st September 2011
Posted by Web Hosting Consultant in tips

Submit your Review

× three = 21