April 8, 2020
4 least Read
You are having problems with malicious users threatening security webpage your? We will help you prevent this. In this article, we will provide you with IP block steps using Hostinger's IP Manager tool and .htaccess. In addition, we will show you how to do geo-blocking with .htaccess, that's how you can block entire countries from accessing the site.
Why do you want to block IP?
The internet is an open space where people around the world can access it 24/7. So your website is no different. In spite of online business While this is an opportunity to achieve revenue, from another perspective, it is a potential threat to user privacy and security.
Why so? Crime exists in the world and is not limited to whether in your city or on the web. These objects are usually spammers, hackers and dangerous users.
The malicious intent that some people want to accomplish has varying degrees of harm. The common case is that they post negative and / or offensive comments on your website.
However, this can escalate quickly and violate security implicit if you do not take preventative action immediately.
One of the best commonly used security you can use is their IP block. Similar to the homepage address, the Internet Protocol address is the unique identifier that every computer on the network has.
By blocking users' IPs, you will cut off communication lines and prevent them from accessing the site.
Block IP by IP Manager
There are several methods on how to block IP access to websites. The easiest way is to use the feature IP Manager on the Control Panel.
- Open Hostinger hPanel, then navigate to IP Manager in section Other.
- In box Block an IP Address, enter the IP address you want to block in the text box IP to Deny and additional comments on the text box Notes. When done, click Add
- To undo this process, repeat the same procedure on the section Allow an IP Address.
- If the process is successful, a confirmation message will appear on your screen.
Congratulations! You have blocked access to users from that particular IP address. To block IP access to the site, you can repeat these steps as many times as needed.
Block IP using .htaccess
Another way to block IP is by using .htaccess, the file that you can access if you're running Apache as your web server (Hostinger uses Apache). By denying the IP address access to the configuration file of the Apache web server, the banning process can be executed before the website is fully loaded.
Here's how to do it via file .htaccess:
- Open Hostinger hPanel, then navigate to the section File Manager in Files.
- Open the file .htaccess in the directory public_html by clicking on the file then use the feature Edit on the toolbar.
You can do so by connecting your account via FTP Client (see posts for more information on this method).
- When the page Edit File Once opened, insert the following lines above the existing code
Order Deny, Allow
Deny from 127.0.0.1
Make sure you make a backup copy of the original code in case it fails. When done, click Save & Close.
That is all! Pretty easy and simple, right?
Geo-Blocking with .htaccess
There are cases of attacks coming from a certain country. Or, you don't want users in some countries to access your content for specific reasons. To solve this situation, you can deny access from a specific country by file .htaccess.
- Open the file .htaccess in the directory public_html and leave it open.
- Create a list of IP addresses from the country you selected above webpage this. To do so, click the country name, then set the format to Apache .htaccess Deny. When done, click on Create ACL.
- Copy the code from the created list into the file .htaccess, then click Save & Close.
- Now users around the world can access your site, except for residents in your country who refuse to access it.
Block IP is one of the best ways to protect websites from malicious attacks. Contrary to popular belief, it's easy to accomplish it IP Manager and file .htaccess.
To block IP with IP Manager, you need:
- Open IP Manager on hPanel
- Enter the IP address to be targeted at Block an IP Address
If you choose to use the file .htaccess Instead, you need to:
- Open section File Manager on hPanel
- Open the file .htaccess in your directory public_html with the Edit feature
- Add syntax containing the targeted IP address along with access
You can also block access to the website from a certain country by .htaccess file:
- Open the file .htaccess in the directory public_html with the Edit feature
- Create a list of IP addresses from the targeted country on the page Country IP Blocks site
- Copy the code from the created list into the file .htaccess
Using these methods, your website will be a safe place for everyone, especially you. Try blocking IP immediately for more security! If you have problems, please leave a comment and discuss with me.