You want a lot of people to visit your website, but for one reason or another you don’t want just everyone to be able to do that, do you?
You reasons may be varied; you might have content that is off-limits to those below 18 years old, you might have material that is considered illegal when viewed in another country, or perhaps you might want to limit access to paying subscribers.
Whatever your reason is, with cPanel you can block any IP address from accessing your site.
How to find out a visitor’s IP address
First things first, you can use the web statistics tools to find more information on your visitors. Go to cPanel and click on the Latest Visitors icon. Look for the Host information; it could be either an IP or a domain name.
How to block the IP address
You can put as many as you want, although it is suggested you limit the number of IP addresses blocked. If you want to block a considerable number of IP addresses you might need the help of your webhost server.
How to unblock the IP address
If you want to deny everyone from accessing your site it gets a little more complicated because this must be done by coding your .htaccess file as follows:
deny from all
allow from (server IP address)
allow from (your IP address) #my house
Remember that it is possible to block access to yourself accidentally by doing this, so be sure to allow access via your IP otherwise you will be blocked as well.
You can find out your current IP address by visiting www.whatismyip.org. If you find you have accidentally blocked yourself, contact you webhost server immediately. As a safeguard they will require you to confirm your identity and verify your account before they can unblock your IP.
Can you block an entire region or country from seeing your site? With cPanel’s mod-geoip you can. Just follow the steps below:
Add the following lines:
We have nothing against Russia, but say for example you don’t want your site to be accessed from there. Go back to the GeoIP .dat file:
Edit /usr/local/apache/conf/includes/pre_main_global.conf again and make it look like this:
Russia will now be blocked.