Restricting IP addresses access to subdomain via .htaccess file

In cPanel-> under Subdomains section you can create the subdomain for your domain.


After creating the subdomain a folder will automatically get created in the File manager.


Inside the subdomain folder, you can see the .htaccess file


In that file, you add the code to allow a range of Ip addresses to access your website.



How to block the IP address


Login to cPanel and click IP Deny Manager.


Under "Add an IP to deny", please enter IP address or domain name you wish to block.


Click the Add button.


How to unblock the IP address


Login to cPanel and click IP Deny Manager.


At the bottom, under "Current IP addresses being blocked", click Remove.

Deny All


You can also set an option for deny from all, which will deny everyone.


This must be done by coding your .htaccess file as follows:


deny from all

allow from

allow from #my house


EAC Team

  • 324 Users Found This Useful
  • .htaccess
Was this answer helpful?

Related Articles

 How to force www or non-www in your .htaccess file in cPanel

1. Log into your cPanel.  2. Find the Files category and click on the File Manager icon.3. Click...

 How to deal with Git on our shared servers

1. OverviewGit is a distributed version control system. While it may sound confusing, it helps to...