How to ban visitors by IP address?
Access control is a vital part of the management process of a website, an online store, etc. We all know that there are people on the Internet who we don’t want on our website. Whether they are just annoying spammers or mischievous hackers representing a considerable threat to our website’s security, it is without doubt very important to know a way or two to block them off.
Ban by IP using the Arastta Admin Dashboard
The Admin Dashboard provides the easiest way to enable or disable visitor access on your store. The process is fairly simple:
- First, login to your admin control panel.
- Go to Customers > Customers > Banned IP
- Click the Add New button which is located in the top right corner.
- Type in the IP address you want blocked from your website.
- When you are ready, hit Save.
As you can see, the power to ban by IP is only a few clicks away.
Handling security on the server side
The other way to employ access control relies on the server, rather than the Arastta application. It can be done by using two methods - modifying the .htaccess file and using the cPanel IP Address Deny Manager. The latter, of course, is only possible if your hosting service is providing a cPanel.
Using the .htaccess file
- Go to your Arastta installation.
- Open the .htaccess file (if you don’t have one, you can create one yourself, just create a new file and save it as .htaccess)
- In this file, using the keywords Deny from, you can enlist the IPs that you want to restrict from viewing your website, eg.: Deny from 18.104.22.168
- Using Allow from, you can enlist IPs which will be allowed to visit your website, eg.: Allow from 22.214.171.124
You can combine Deny from and Allow from using the Order keyword, eg.:
Order deny, allow
Deny from all
Allow from 126.96.36.199
This way you can enable only certain visitors to your website.
Using the cPanel IP Address Deny Manager
- Login to your cPanel.
- Scroll down to the Security section.
- Open the IP Address Deny Manager. This page you will see will be something like this:
- Type the IP you want to block.
- Hit Add.
- You will be redirected to a success page, if you click Back, you can see the IP you typed in the list with other restricted IPs.
It is up to you to choose your preferred method. The one using the Arastta admin panel is the easiest, but the others provide you with the opportunity to enlist a lot of IPs much faster. In the cPanel IP Address Deny Manager for example, you can type 188.8.131.52 -184.108.40.206 and all the IPs in between will be added to the list.