logo

Black Friday
Sale

  •  99.9% Uptime
  •  Free SSL Certificate
  •  24/7 Live Support
  •  30-Days Money-Back Guarantee
Get Started

Up To

90

%

OFF

00
DAYS
05
HOURS
08
MINUTES
46
SECONDS
Black Friday Sale: Best Web Hosting
From ₹45.00 /Month!
See All Deals
×

Hostinger's Knowledge Base

Find articles and information about features, various troubleshooting guides,
and other technical information related to the Hostinger's services

How to block IP using .htaccess file?

Modified on:
htaccess country blocked block IP IP block

You may block access to your website from specific IP addresses using .htaccess file.

You need to create this file in your public_html folder and add these example lines:

order allow,deny deny from 127.0.0.1 allow from all 

These lines will block access for all users using 127.0.0.1 IP address. Just change the 127.0.0.1 to the IP you want to block.

You can download the list of each country IPs from following link: https://www.countryipblocks.net/country_selection.php