Skip to main content

How to Use IP Deny Manager in cPanel to Block Unwanted Visitors

Online security matters more than ever these days, especially with cyberattacks and data breaches on the rise. That's why it's so important to keep unwanted visitors away from your website. Thankfully, cPanel comes with a built-in tool called IP Deny Manager that makes this simple. With it, you can block specific IP addresses or domains from accessing your site—giving you more control and peace of mind. This guide provides instructions for blocking IP addresses using cPanel. If you prefer to manage IP restrictions through your Account Manager, please refer to the guide: Use an IP Blocker to Secure a Website from Malicious Traffic.

  • Why Block an IP Address?
  • How to Find a Visitor's IP Address in cPanel
  • Using IP Deny Manager in cPanel
  • How to Deny All Access Using .htaccess
  • Summary

Why Block an IP Address?

Blocking IP addresses can help:

  • Prevent spam comments and junk traffic
  • Stop hacking attempts and brute-force attacks
  • Mitigate DDoS (Denial of Service) attacks
  • Protect bandwidth and server resources

How to Find a Visitor's IP Address in cPanel

To identify a visitor's IP address using the Visitors tool in cPanel:

  1. Log in to your cPanel.

  2. Scroll down to the Metrics section and click Visitors. Bluehost cPanel - Visitors

  3. Select your domain from the list and click the magnifying glass icon. Bluehost cPanel - Visitors View

  4. Review the visitor details:

  • IP — This refers to the visitors' IP address.
  • URL — This is the specific URL the visitor accessed on your website.
  • Time — This is when the visitor accesses your website.
  • Size (bytes) — This refers to the server's data for this resource to the visitor.
  • Referring URL — This is the web address from which the visitor navigated to the resource.
  • User Agent — This is the visitor's browser for accessing your website.

Click the gear icon to view more data: Bluehost cPanel - Visitors Gear

  • Status — This HTTP code indicates whether the requested resource was loaded successfully or if an error occurred.
  • Method — This refers to the request-response type between the client and server, such as GET or POST.
  • Protocol — This is the version of HTTP that the server uses to serve the requested resource to the visitor, for example, 1.1.

Once you've identified a suspicious IP, you can block it using the IP Deny Manager.

Using IP Deny Manager in cPanel

  • How to Block an IP Address or Domain
  • How to Unblock an IP Address or Domain

How to Block an IP Address or Domain

  1. Log in to your cPanel.

  2. Scroll down to the Security section and click IP Blocker. Bluehost cPanel - IP Blocker

  3. In the Add an IP or Range field, enter the IP address or domain name you want to block. Bluehost cPanel - IP Blocker Add an IP or Range

  4. Click Add. Bluehost cPanel - IP Blocker Add an IP or Range Add

How to Unblock an IP Address or Domain

  1. Log in to your cPanel.

  2. Go to Security and clickIP Blocker. Bluehost cPanel - IP Blocker

  3. Scroll down to the list of blocked IPs/domains.

  4. Find the IP or domain you want to unblock.

  5. Click Delete under the Actions column. Bluehost cPanel - IP Blocker Add an IP or Range Delete

  6. Confirm by clicking Remove IP. Bluehost cPanel - IP Blocker Add an IP or Range Delete Confirmation

How to Deny All Access Using .htaccess

To block all traffic except specific IPs:

  1. Open your .htaccess file.
  2. Add the following code: ``` deny from all allow from 70.24.291.52 allow from 216.130.49.223 #My IP address

For general instructions on making changes to your .htaccess file, please refer to the article How to Edit Your .htaccess File.
**Warning:** Be careful when using deny from all. If you don't whitelist your own IP, you may block yourself from accessing your site.

To find your current IP address, visit: http://www.bluehost.com/ip. If you accidentally block yourself, contact Bluehost support. You'll need to verify your account to get unblocked.
## Summary
The IP Deny Manager in cPanel is a great tool for keeping your website secure. It lets you block unwanted visitors, stop suspicious activity, and manage who can access your site. When you use it alongside the Visitors tool, you can monitor traffic and spot potential issues early—helping you stay ahead and keep your online space safe.