Back to Shared Hosting Documentation

    IP Address Blocking

    Control access to your website by IP address

    What is IP Blocking?

    IP blocking allows you to deny or allow access to your website from specific IP addresses or ranges. This is useful for preventing spam, blocking malicious visitors, or restricting access to specific users.

    How to Block an IP Address

    Method 1: Using cPanel IP Blocker

    1. Log in to your cPanel account
    2. Navigate to the "Security" section
    3. Click on "IP Blocker"
    4. Enter the IP address you want to block
    5. Click "Add"

    Method 2: Using .htaccess

    For more advanced control, you can edit your .htaccess file:

    # Block a single IP address
    Deny from 192.168.1.1
    
    # Block multiple IP addresses
    Deny from 192.168.1.1
    Deny from 192.168.1.2
    
    # Block an IP range
    Deny from 192.168.1.0/24

    How to Allow Only Specific IPs

    To create an allowlist (whitelist) that only allows specific IP addresses:

    Order Deny,Allow
    Deny from all
    Allow from 192.168.1.1
    Allow from 192.168.1.2

    Blocking IP Ranges

    You can block entire IP ranges using CIDR notation:

    /24blocks 256 addresses (e.g., 192.168.1.0/24)
    /16blocks 65,536 addresses (e.g., 192.168.0.0/16)
    /8blocks 16,777,216 addresses (e.g., 192.0.0.0/8)

    Common Use Cases

    Block Spam Bots

    Prevent automated spam from known bot IPs

    Geographic Restrictions

    Block traffic from specific countries (using IP ranges)

    Malicious Visitors

    Block IPs showing suspicious behavior

    Development Access

    Allow only your office IP to access staging sites

    Finding IP Addresses to Block

    You can find IP addresses in several places:

    • Access Logs: Check Raw Access logs in cPanel
    • Error Logs: Review error logs for suspicious activity
    • Security Plugins: Use WordPress security plugins that log attempts
    • Server Stats: Check Awstats or Webalizer in cPanel

    Important Considerations

    • Blocking too many IPs can affect performance
    • Dynamic IPs change frequently, so blocks may become ineffective
    • VPNs and proxies can bypass IP blocks
    • Be careful not to block search engine crawlers
    • Test after blocking to ensure your site still works

    Removing IP Blocks

    To unblock an IP address:

    1. Go to IP Blocker in cPanel
    2. Find the IP in the list of blocked addresses
    3. Click the "Delete" button next to it

    Or remove the corresponding line from your .htaccess file.

    Troubleshooting

    Blocked Yourself

    Contact support to have your IP unblocked

    Not Working

    Check .htaccess syntax and file permissions

    Site Down

    Make sure you didn't block Cloudflare IPs if using CDN