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 70.24.291.52

allow from 216.130.49.223 #my house

Regards

EAC Team

  • .htaccess
  • 324 Users Found This Useful
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...