How to Block IP with IP Manager and .htaccess

    Are you having problems with malicious users threatening your site 's security We will help you prevent this. In this article, we will provide you with IP block steps using Hostinger's IP Manager and .htaccess tools . In addition, we will show you how to do geo-blocking with .htaccess , which is how you can block entire countries from accessing websites.

    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. Although online business sees this as an opportunity to earn revenue, from another perspective, it is a potential threat to the privacy and security of users.
    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 potentially security breaches if you don't take immediate precautions.
    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 IP Manager feature on the Control Panel.
    Here's how:
    1. Open Hostinger hPanel, then navigate to IP Manager in Other section .Part IP manager in control panel
    2. In the Block an IP Address box , enter the IP address you want to block in the IP to Deny text box and additional comments on the Notes text box When done, click Add
      IP block feature
    3. To undo this process, repeat the same procedure on the Allow an IP Address section .
    4. If the process is successful, a confirmation message will appear on your screen.successfully block ip
    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 IPs is to use .htaccess , which you can access if you are 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 through the .htaccess file :
    1. Open Hostinger hPanel, then navigate to the File Manager section of Files.
      Open file manager in hPanel
    2. Open the .htaccess file in the public_html directory by clicking on the file and then using the Edit feature on the toolbar.public_html directoryYou can do so by connecting your account via the FTP Client (see the article for more information on this method).
    3. Once the Edit File page is opened, insert the following lines above the existing code
      1. Order Deny, Allow
      2. Deny from 127.0 .0 .1
      Add the code to .htaccess
    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 with a .htaccess file .
    1. Open the .htaccess file in the public_html directory and leave it open.
    2. Create an IP address list from the country of your choice on this site . To do so, click on the country name, then set the format to Apache .htaccess Deny . When done, click on Create ACL.Create an IP block list using Country IP Blocks
    3. Copy the code from the created list into the .htaccess file , then click Save & Close .
    4. Now users around the world can access your site, except for residents in your country who refuse to access it.

    Epilogue

    Block IP is one of the best ways to protect websites from malicious attacks. Contrary to popular belief, it can be easily implemented using IP Manager and .htaccess files .
    To block IP with IP Manager, you need:
    1. Open IP Manager on hPanel
    2. Enter the IP address targeted at Block an IP Address
    If you choose to use the .htaccess file instead, you need to:
    1. Open the File Manager section on hPanel
    2. Open your .htaccess file in public_html folder with Edit feature
    3. Add syntax containing the targeted IP address along with access
    You can also block access to websites from a certain country with a .htaccess file:
    1. Open the .htaccess file in the public_html directory with the Edit feature
    2. Create a list of IP addresses from the targeted country on the Country IP Blocks site
    3. Copy the code from the created list into the .htaccess file
    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

    No comments