How to restrict Directory Access by IP address

How to restrict Directory Access by IP address

In order to secure your "admin area" from hackers, we recommended you to allow access only from your selected IP to your admin directory. You just need to create an .htaccess file in the directory where you want to restrict access by IP Address.

For example, if you have a WordPress blog installed on your main directory like example.com/wp-admin, you should create an .htaccess file in /wp-admin/.htaccess and you should put this code in, and not forget to replace the allowed IP address with your IP address.

order deny,allow

deny from all

allow from YOUR-IP-ADDRESS-HERE


(Replace "Your-IP-Address-Here" text with your IP Address)

You can test this by accessing your /wp-admin IP address from another IP address which is not allowed by your .htaccess file.

    • Related Articles

    • How to blacklist a IP address

      You can lock directory with a password by using cPanel "IP Blocker" option. 1. Log into your cPanel account. 2. In the "Security" section, click on "IP Blocker" Icon.  3. Under "Add an IP or Range" you should enter the IP Address you wish to block. ...
    • How to block any IP address

      You can block any IP address by add this line to your .htaccess file: order allow,deny deny from IP-ADDRESS allow from all Replace "IP-ADDRESS" with the IP Address you want to block.
    • Directory Privacy

      To create protection for a directory of your hosting with a Username and Password, follow the steps: In your cPanel, select "Directory Privacy" in the Files section. Then select the directory you want to assign privacy to. Complete the fields as ...
    • JetBackup 5 - Home Directory : How to restore file and folders

      Jetbackup 5 has a new interface, with better usability and new options, making it easier to search for specific items. In this article we will see how to restore files and folders from a cPanel account. First we must access cPanel and navigate to the ...
    • First steps with the Hosting: access

      When you receive the access information by email, you can do the access to the hosting service with the access information include in the email. You can access the hosting service panel (cPanel) in two ways.       1. The first one is by the client ...