Skip to content

403 Forbidden on cPanel: Read the Log Line, Fix the Cause

Find out why a cPanel site returns 403 Forbidden by reading the one log line the server writes for it. Each cause leaves its own code, and each code points to one short, specific fix.

When your cPanel site, or one folder or file on it, shows “403 Forbidden”, this article takes you from that page to the exact cause on a server running Apache. A 403 means something between the visitor and the file refused the request on purpose. The fastest route to the cause is the one log line that the refusing layer wrote about your request, because its code names the cause and each cause has one fix. At least six layers can refuse a request, and guessing between them is how people end up running chmod 777 on a site that had a firewall problem.

What you’ll accomplish

  • Tell in one command whether the 403 comes from a CDN (content delivery network, such as Cloudflare) in front of your server or from the server itself.
  • Find the error line for your request, as root or as a regular cPanel user.
  • Match that line to its cause by the code it carries, such as AH01630 for an access rule or AH00035 for a folder Apache cannot enter.
  • Apply the fix for that cause only, and prove it worked with a clean log and a 200 response.

Prerequisites

  • A cPanel server running Apache through EasyApache 4, cPanel’s tool for building Apache and PHP and the standard setup on current cPanel versions.
  • For the root path: SSH access as root, or WHM access. For the user path: a cPanel login, and SSH as the account user if your host allows it.
  • The URL that fails, your own public IP address (search “what is my IP” from the same network), and the time you last tried it.
  • curl on your workstation.

The examples use the domain example.com, the cPanel user acme, the server IP 198.51.100.20 and the visitor IP 203.0.113.47, which stands for your own public IP. Replace them with your own values. If your server runs LiteSpeed Web Server instead of Apache, the causes are the same, but the AH codes below will not appear, because they are Apache’s own message numbers.

How it works

A request crosses several layers before Apache sends a file back, and any of them can answer 403. The diagram lists them from the outside in, starting with any CDN or web application firewall (WAF) in front of your server, and shows the fingerprint each leaves.

Diagram of where a 403 can be issued on a cPanel site: a CDN or WAF edge leaves a Server: cloudflare header and nothing in origin logs; ModSecurity logs Access denied with code 403 and a rule id; access rules log AH01630 or AH01797; rewrite rules show a 403 in the access log while error_log stays silent; file permissions log AH00035 or AH00132 with (13)Permission denied; a missing index file logs AH01276; only when all pass is the page served with 200 OK

The order matters for one reason: a layer near the top hides everything under it. If Cloudflare blocks the visitor, your server never sees the request, so no amount of permission fixing helps. That is why the first step tests the edge.

On the server, Apache keeps one shared error log for all sites, at /etc/apache2/logs/error_log on EasyApache 4. Per-site access logs, which cPanel calls domlogs, sit in /etc/apache2/logs/domlogs/. Older guides use /usr/local/apache/logs/, which is the pre-EasyApache 4 location. Each error line follows Apache’s standard format: a timestamp, the module and severity in brackets, the process ID, the client address, then a message that starts with an AH code.

A regular cPanel user cannot read the shared error log. In cPanel, open Metrics » Errors instead. It shows up to 300 of the most recent error entries for your account, newest first. Your account’s access logs are in Metrics » Raw Access, or at ~/access-logs/ over SSH.

Step-by-step

  1. Test the edge before anything else. Ask for the headers of the failing URL through the public route:

    curl -sI https://example.com/shop/ | grep -iE '^(HTTP|server|cf-ray)'

    Example output:

    HTTP/2 403
    server: cloudflare
    cf-ray: 8d3c51a9fe2b4e17-YUL

    Now ask your server directly, which hosting people call the origin. The --resolve option makes curl skip DNS and connect to the IP you give it, while still sending the right hostname. Use the shared or dedicated IP from the General Information panel on your cPanel home page:

    curl -sI --resolve example.com:443:198.51.100.20 https://example.com/shop/ | grep -iE '^(HTTP|server)'

    Example output:

    HTTP/1.1 200 OK
    Server: Apache

    If your server has HTTP/2 turned on, the first line reads HTTP/2 200 instead, which means the same thing. A public 403 with server: cloudflare and a 200 from the origin means the CDN blocked the request. Open your CDN’s security events log and search for the Ray ID, the per-request reference in the cf-ray header. The event names the rule or setting that blocked you, and that one item is what you change. Nothing on the cPanel server needs to change. If the events log has no entry for that Ray ID, or both answers are 403, your server refused the request, so continue with step 2.

  2. Find your request in the error log. As root, search for your IP:

    grep '203.0.113.47' /etc/apache2/logs/error_log | tail -n 5

    Expected: one to five lines shaped like the examples in steps 4 to 8, each with your IP after [client.

    As a cPanel user, open Metrics » Errors, reload the failing page, and refresh the list. The newest line at the top should carry your IP and the path.

    If you find no line at all, check the access log for the 403:

    grep '203.0.113.47' /etc/apache2/logs/domlogs/example.com-ssl_log | grep '" 403 ' | tail -n 3

    Example output:

    203.0.113.47 - - [17/Oct/2026:09:38:52 -0400] "GET /wp-content/uploads/2026/09/hero.jpg HTTP/1.1" 403 199 "https://other-site.example/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"

    A 403 in the access log with nothing in the error log points to a rewrite rule (step 7). No 403 anywhere means the request never reached this server, so go back to step 1 and check that DNS points where you think.

  3. Read the line and pick your step. The code tells you where to go:

    • ModSecurity: Access denied with code 403: step 4.
    • AH01630 or AH01797, “client denied by server configuration”: step 5.
    • AH00035 or AH00132, after (13)Permission denied: step 6.
    • AH00529, “unable to check htaccess file”: step 6.
    • AH01276, “Cannot serve directory”: step 8.

    Fix one cause, test, and only then look for a second one.

  4. ModSecurity: find the rule, then disable that rule only. ModSecurity is a web application firewall (WAF) module, a filter that inspects each request for attack patterns. Its line looks like this:

    Example output:

    [Sat Oct 17 10:03:19.774102 2026] [security2:error] [pid 52240:tid 52301] [client 203.0.113.47:44718] [client 203.0.113.47] ModSecurity: Access denied with code 403 (phase 2). Operator GE matched 5 at TX:anomaly_score. [file "/etc/apache2/conf.d/modsec_vendor_configs/OWASP3/rules/REQUEST-949-BLOCKING-EVALUATION.conf"] [line "94"] [id "949110"] [msg "Inbound Anomaly Score Exceeded (Total Score: 5)"] [hostname "example.com"] [uri "/wp-admin/post.php"] [unique_id "ZxEdl7Kj3m0AAMzQ4hUAAAAJ"]

    The file path depends on the rule set your server uses. OWASP3 is cPanel’s packaged OWASP Core Rule Set, a widely used set of ModSecurity rules. Note the id. Rule 949110 only adds up a score: each matching rule adds points, and this one blocks the request once the total passes a limit. The rule that actually matched sits in an earlier line with the same unique_id, so search for that value and use the id you find there. As root, go to WHM » Home » Security Center » ModSecurity® Tools, open the Rules List, and disable that one rule. As a cPanel user, send your host the rule id, the time, your IP and the URL. Do not turn ModSecurity off for the whole site. Clearing ModSecurity false positives on wp-admin covers scoping a rule to one path.

  5. Access rules: find the line that denies you. AH01630 comes from the current Require syntax. AH01797 comes from the older Order, Allow and Deny from syntax, which Apache still accepts through a compatibility module:

    Example output:

    [Fri Oct 16 22:41:07.093615 2026] [authz_core:error] [pid 31877:tid 31940] [client 203.0.113.47:60231] AH01630: client denied by server configuration: /home/acme/public_html/wp-login.php

    Rules in a parent folder apply to every folder below it, so search every .htaccess from the document root down to the denied path. Here the denied file sits in public_html, so one file is enough. For a file in public_html/shop/, add /home/acme/public_html/shop/.htaccess to the command:

    grep -nE 'Require|Deny|Allow|Order' /home/acme/public_html/.htaccess

    Example output:

    40:<RequireAll>
    41:    Require all granted
    42:    Require not ip 203.0.113.0/24
    43:</RequireAll>

    A Require not ip or Deny from that matches your address is the cause. Here 203.0.113.0/24 covers every address from 203.0.113.0 to 203.0.113.255, including yours. If grep prints nothing, the rule is in a parent folder or in the server’s Apache configuration, which only root can change. If it came from Security » IP Blocker in cPanel, which adds addresses to .htaccess for you, remove the address there. Otherwise delete or narrow the line by hand.

  6. Permissions: find the part of the path Apache cannot open. Apache’s own processes run as the user nobody on cPanel. AH00035 means a folder in the path cannot be entered. AH00132 means a file cannot be read:

    Example output:

    [Sat Oct 17 09:12:44.518377 2026] [core:error] [pid 48211:tid 48297] (13)Permission denied: [client 203.0.113.47:52814] AH00035: access to /shop/index.html denied (filesystem path '/home/acme/public_html/shop/index.html') because search permissions are missing on a component of the path

    namei -l lists the owner and mode of every folder on the way to the file:

    namei -l /home/acme/public_html/shop/index.html

    Example output:

    f: /home/acme/public_html/shop/index.html
    dr-xr-xr-x root root   /
    drwx--x--x root root   home
    drwx--x--x acme acme   acme
    drwxr-x--- acme nobody public_html
    drwx------ acme acme   shop
    -rw-r--r-- acme acme   index.html

    The shop folder is drwx------, so only acme can enter it. Set folders to 755 and files to 644, owned by the account user:

    chmod 755 /home/acme/public_html/shop
    chmod 644 /home/acme/public_html/shop/index.html
    chown acme:acme /home/acme/public_html/shop /home/acme/public_html/shop/index.html

    These commands print nothing when they succeed. AH00529 is the same problem one level up: Apache could not read a folder’s .htaccess file, so it refuses the whole folder. Give that .htaccess mode 644 and its folder 755, owned by acme. Leave public_html itself at drwxr-x--- with group nobody. That is cPanel’s normal setting, and it is correct. For a whole site extracted as root, resetting ownership and permissions on cPanel has the bulk commands.

  7. Rewrite rules: look for an [F] flag. A RewriteRule ending in [F] returns 403 without an error line. cPanel’s Security » Hotlink Protection works this way: it blocks images loaded from other sites based on the Referer header, the address of the page that asked for the file. That matches the access log line in step 2:

    grep -nE 'HTTP_REFERER|[[,]F[],]' /home/acme/public_html/.htaccess

    Example output, in the style Hotlink Protection writes (one condition per allowed address, then one rule):

    12:RewriteCond %{HTTP_REFERER} !^http://example.com/.*$      [NC]
    13:RewriteCond %{HTTP_REFERER} !^http://example.com$      [NC]
    14:RewriteCond %{HTTP_REFERER} !^http://www.example.com/.*$      [NC]
    15:RewriteCond %{HTTP_REFERER} !^http://www.example.com$      [NC]
    16:RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    Read the conditions as a list of allowed referring pages. A request for an image is refused when its Referer matches none of them. In this example the list holds only http:// addresses, so an image shown on https://example.com is refused too. No output at all means no referer or [F] rule exists in this file. Add the missing site, including its https:// form, to the allowed URLs in Hotlink Protection, or turn the feature off there. For a hand-written rule, edit the condition so it no longer matches your request. A security plugin that sends its own 403 from PHP also leaves the error log silent. If no rule matches, rename .htaccess to .htaccess.off for one test and put it straight back.

  8. Missing index file: give the folder a page. DirectoryIndex is the list of file names Apache tries when a URL ends at a folder. AH01276 means no file in the folder matches that list, and automatic folder listings are turned off:

    Example output:

    [Fri Oct 16 14:27:31.602948 2026] [autoindex:error] [pid 20733:tid 20791] [client 203.0.113.47:38842] AH01276: Cannot serve directory /home/acme/public_html/landing/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive

    Check what the folder holds:

    ls -la /home/acme/public_html/landing/

    No index.php, index.html or index.htm in the listing confirms the cause. If the start page has another name, such as start.html, rename it to index.html or add DirectoryIndex start.html to that folder’s .htaccess. If the folder is meant to stay private, this 403 is the correct answer. Leave it.

Validate it works

Run the origin request from step 1 again:

curl -sI --resolve example.com:443:198.51.100.20 https://example.com/shop/ | grep -iE '^(HTTP|server)'

Example output:

HTTP/1.1 200 OK
Server: Apache

Then repeat it without --resolve to confirm the public route also returns 200. Finally, prove the log is quiet. As root, watch the error log while you load the page in a browser:

tail -f /etc/apache2/logs/error_log | grep '203.0.113.47'

Success means no new line appears while the page loads. Press Ctrl+C to stop. As a cPanel user, reload Metrics » Errors and check that no new entry carries your IP.

Troubleshooting

The 403 is gone for you but not for other visitors. Your fix matched your own case. Repeat step 2 with one of their IPs, taken from the access log. IP-based rules and edge security levels often treat different networks differently.

The 403 comes back a few hours later. A deployment tool, a backup restore or an FTP client set the old modes again. Check its upload or permission settings, then repeat step 6.

Metrics » Errors is empty. The entry may have scrolled out of the 300-line window, or the 403 came from a rewrite rule, which writes no error line. Reproduce the 403 and look straight away, or ask your host for the matching line from /etc/apache2/logs/error_log.

Every site on the server returns 403. One account’s .htaccess cannot do that. Look for a server-wide cause, such as a recent Apache configuration change or a ModSecurity rule set update, starting with the newest lines in the error log.

When this is the wrong approach

If the browser shows a username and password box, you have a 401 from Directory Privacy, not a 403. Use the password, or remove the protection in Files » Directory Privacy.

If the 403 protects something that should never be public, such as wp-config.php, a backup folder or xmlrpc.php, it is doing its job. Confirm the rule is intentional and move on.

If you cannot get any log line, as root or through your host, this method has nothing to read. Work through the layers in the diagram’s order and test after each change. Then ask your host for access to your logs before the next 403. For the log format itself, the Apache log files documentation explains every field, and cPanel’s About Apache page lists where EasyApache 4 keeps each log.

If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.