1. Knowledge Base
  2. >
  3. Results
  4. >
  5. How Do I Deny an IP Address Access?

How Do I Deny an IP Address Access?

Do you want to stop someone from visiting your website? Below are the steps in blocking a specific IP Address. 

You may find some links below that will redirect you to your cPanel and its features provided that the following conditions are met:
  • You are logged into your Customer Portal. You can also log in after clicking the link.
  • The hosting package you are attempting to access is either Shared or Cloud.

How to Find Out a Visitor’s IP Address

  1. Log in to your cPanel.
  2. Click the Visitors button in the Metrics section

    HostGator cPanel Metrics Section

  3. Select the domain name to view its recent visitor by clicking on the magnifying lens icon.

    Cpanel site visitor's IP address view

  4. This will redirect you to a page where you can see the IP address of your site visitors.

    cPanel view site visitors IP address

How to Block a Specific IP Address

Here are the steps outlined in the video guide above.

  1. Log into cPanel.
  2. Click on IP Blocker in the Security section.

    HostGator cPanel IP Blocker

  3. In the IP Blocker section, add the site visitor’s IP address that you wish to deny access to your site on the IP address field.

    HostGator Block an IP address section

  4. Click the Add button. You will then be redirected to a successful confirmation page.

How to Unblock the IP address

  1. Log into cPanel
  2. Click on IP Blocker in the Security section.

    HostGator cPanel IP blocker section

  3. Under Currently-Blocked IP Addresses: select the IP address you wish to unblock.

    HostGator Cpanel Unblock IP Address

  4. Click the Delete icon.

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:

.htaccess deny all IP

See the article on How to Edit Your .htaccess File for generic instructions that apply to all .htaccess changes.

Note: It is possible to block access to yourself accidentally by using this method.

Be sure to allow access via your IP; otherwise, you will be blocked as well. You can find out your current IP address by visiting the What is your IP? page. If you accidentally block yourself, please contact HostGator via phone or Live Chat. You will need to confirm your identity ("verify your account") before we can unblock your IP.