How to block an IP address using .htaccess?

You can block traffic coming from any specific IP addresses with .htaaccess file. Please refer to the below steps to block ip address using .htaccess.

  1. Login to your cPanel account and open the file manager.

    file manager

  2. Open the pubic_html directory.

  3. Click on the setting and tick the Show Hidden Files (dotfiles) option and click save.

    show hidden files

  4. Right-click on the .htaccess file and click on the edit.

  5. Insert the following lines inside .htaccess file as shown in the screen capture and save the file.

    Order Denny, Alllow
    Deny from

      Note: replace the IP with the actual IP address, you want to block for your website.

Related Articles

How to place an order for Linux VPS hosting?

Step-1: First, select your desired Linux VPS Hosting plan with your desired billing cycle...

How to Install Minecraft Game Server in Linux VPS?

This article will assist you to install Minecraft Server in your Linux VPS. Checkout our VPS...

How to place Classic VPS order?

This is a video tutorial about selecting an appropriate configuration for your Classic VPS order....

bash: netstat: command not found.

You may face the below error on your Linux OS if you haven’t installed the netstat command...

How to add remote MySQL connection in linux?

Please refer to the following 3 steps to add a remote MySQL connection in Linux. Edit MySQL...

  • 0 Users Found This Useful

Was this answer helpful?