# Fix unjustified 403s

- Check 05.11 · HTTP and redirects · Critical
- Source: https://checklist-seo-geo.com/en/http-redirects/fix-unjustified-403s
- Find the source of 403s on your public pages (WAF, permissions, access rules, S3, plugins) and fix it on Apache, Nginx, Cloudflare, AWS or WordPress.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/http-redirects/fix-unjustified-403s.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

The `403 Forbidden` code means “I understood you, but I refuse.” It is legitimate on an admin area or for a crawler you have chosen to exclude; it is not on a public page you want indexed and cited. This task consists of spotting the 403s that visitors and crawlers receive on public pages, identifying the layer that produces them (CDN, web application firewall, web server, file system, application) and fixing the rule at fault.

## Why it matters

Google groups 403 with the other 4xx codes, except 429: an indexed URL that returns 403 is removed from the index, and a new URL is not processed. For Googlebot, a 403 does not mean “try again later” but “this content is not for you”. Google also specifically says not to use 401 or 403 to limit the crawl rate.

Unjustified 403s are common because several layers can produce them, each without warning the others:

- **Firewall and CDN**: an overly broad custom rule, country blocking, anti-bot protection, a list of banned user agents that contains a crawler you wanted to let in.
- **Web server**: a forgotten `Require all denied`, a folder with no index file and directory listing disabled, an anti-hotlinking rule.
- **File system**: a file or folder the web server user cannot read after a deployment or a restore.
- **Object storage**: S3 returns 403 instead of 404 for a missing object when the requester does not have permission to list the bucket.
- **Application and plugins**: a WordPress security plugin, the host's ModSecurity, access control applied to public pages by mistake.

The problem is often selective: the page displays for you, logged in and from your own address, but not for a crawler or a visitor from another country. Generative engine crawlers are particularly exposed: their user agents are recent and missing from allowlists, and their requests come from data centers that many protections consider suspicious.

## What it improves

- **Indexing**: public pages wrongly blocked return to the index after the fix and a fresh crawl.
- **Visibility in generative engines**: the search and retrieval crawlers of the AI assistants you have chosen to let in can read your pages. That still does not guarantee citations.
- **Images and files**: resources blocked by an anti-hotlinking rule become accessible again to Googlebot-Image and to page rendering.
- **Visitors**: fewer legitimate visitors turned away because of a country, a VPN or a firewall false positive.
- **Rankings**: no direct effect; the effect comes through the pages that were excluded from the index.

## How to check

**1. Search Console.** In the [Page indexing report](https://search.google.com/search-console/index), open the “Blocked due to access forbidden (403)” reason. Every example must be a URL you genuinely want to refuse. Test a public URL with the [URL Inspection tool](https://search.google.com/search-console?action=inspect), using the “Test live URL” button.

**2. Compare the responses depending on the client:**

```bash
URL="https://example.com/blog/guide/"
for ua in "Mozilla/5.0" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" "OAI-SearchBot/1.0; +https://openai.com/searchbot" ""; do
  printf "%s  [%s]\n" "$(curl -s -o /dev/null -w '%{http_code}' -A "$ua" "$URL")" "${ua:-no user agent}"
done
```

A 403 for a crawler user agent only reveals a rule based on the user agent. This test does not reproduce the crawlers' IP addresses: a rule based on IP or country only shows up in the logs or with the URL Inspection tool. See [test HTTP responses for each crawler](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/test-http-responses-each-crawler).

**3. Identify the layer that responds**, from the headers and the body of the response:

```bash
curl -s -D - -o /tmp/reponse.html "$URL" | grep -i -E "^(HTTP|server|cf-ray|cf-mitigated|x-amz|x-cache|x-sucuri|x-litespeed)"
grep -o -i -E "error 10[0-9]{2}|cloudflare|wordfence|mod_security|imunify|access denied|forbidden" /tmp/reponse.html | sort -u
```

| Clue | Likely layer |
|---|---|
| `server: cloudflare` and an “Error 1020”, “1010” or “1012” page | Cloudflare security rule |
| `cf-mitigated: challenge` | Cloudflare challenge (which crawlers do not solve) |
| `x-amz-…`, XML body `AccessDenied` | S3 or CloudFront |
| “Your access to this site has been limited” page | Wordfence |
| Mention of ModSecurity or Imunify360 | Host's firewall |
| Plain “Forbidden” server page | Apache, Nginx or LiteSpeed |

**4. Count the 403s in the logs**, by path and by user agent:

```bash
awk -F'"' '{split($3, s, " "); if (s[1] == 403) print $2 " | " $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -30
```

## How to implement

### Before you start

Draw up the list of what must return 403: administration, staging (better still, authentication: see [protect staging](https://checklist-seo-geo.com/en/indexing-canonicalization/protect-staging-private-data-authentication)), sensitive files, crawlers you have decided to exclude. Everything else is an unjustified 403.

Three principles for the fix:

- **Exempt verified crawlers by their IP, never by user agent** alone, which anyone can spoof. See [verify crawler identity against official IP ranges](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/verify-crawler-identity-against-official-ip-ranges-if-possible).
- **Choose the right code**: `404` for missing content, `401` for content that requires logging in, `429` for too many requests, `403` for an intended refusal.
- **Prefer robots.txt to keep out a search crawler** that respects it: it is easier to read than a 403 and reversible. See [configure robots.txt to match your goals](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/configure-robotstxt-match-these-goals).

### Apache

Versions: Apache 2.4, with ModSecurity 2.9 for the rule exclusion.

The error log gives the exact cause of each 403:

```bash
sudo grep -E "AH01630|AH01276|AH00035|AH01797|ModSecurity" /var/log/apache2/error.log | tail -20
```

- **`AH01630: client denied by server configuration`**: a `Require` directive denies access. Look for `Require all denied`, `Require not ip` or old `Deny from` directives in the virtual host and the `.htaccess` files, and restrict them to the folders concerned:

```apache
<Directory "/var/www/example/public">
    Require all granted
</Directory>

<Directory "/var/www/example/public/admin">
    Require ip 203.0.113.0/24
</Directory>
```

- **`AH01276: Cannot serve directory`**: the folder has no index file and directory listing is disabled. Add the expected file or fix `DirectoryIndex index.php index.html`.
- **`AH00035: … search permissions are missing`**: the Apache user cannot traverse a parent folder. See the section on permissions below.
- **ModSecurity**: a false positive blocks a URL or a parameter. Note the rule ID (`[id "942100"]`) and exclude it for the path concerned rather than disabling the module:

```apache
<LocationMatch "^/recherche">
    SecRuleRemoveById 942100
</LocationMatch>
```

Anti-hotlinking rules: let through requests with no referrer, which is what image crawlers send:

```apache
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https://(www\.)?example\.com/ [NC]
RewriteRule \.(jpe?g|png|webp|avif|gif)$ - [F]
```

Reload with `sudo apachectl configtest && sudo systemctl reload apache2`.

### Nginx

Versions: Nginx 1.18 and later.

```bash
sudo grep -E "forbidden|Permission denied|access forbidden by rule" /var/log/nginx/error.log | tail -20
```

- **`directory index of "…" is forbidden`**: no index file in the folder. Fix the `index` directive or the `try_files`.
- **`(13: Permission denied)`**: a permissions problem, see below.
- **`access forbidden by rule`**: a `deny` directive applies. Review the `location` blocks and the security `include` files (user agent lists, country lists):

```nginx
# A rule like this also blocks crawlers you want to let in
if ($http_user_agent ~* "(bot|crawler|spider)") {
    return 403;
}
```

Replace generic lists with rules targeting the crawlers you have decided to exclude, and check the `valid_referers` blocks for images as for Apache (keep `none` in the list). Reload with `sudo nginx -t && sudo systemctl reload nginx`.

### File permissions

After a deployment or a restore, unreadable files produce 403s. Check each level of the path, then restore standard permissions:

```bash
namei -l /var/www/example/public/index.php
sudo find /var/www/example -type d -exec chmod 755 {} \;
sudo find /var/www/example -type f -exec chmod 644 {} \;
```

Adjust the owner (`www-data`, `nginx`, `apache` or the hosting account user). On a system with SELinux, an incorrect context causes the same symptom: `ls -Z` and `restorecon -Rv /var/www/example` fix it.

### Cloudflare

Versions: Cloudflare dashboard, all plans, November 2026.

Open [`Security > Analytics`](https://dash.cloudflare.com/?to=/:account/:zone/security/analytics), `Events` tab, filter on the `Block` action or on the path concerned, and see which service made the decision: custom rule, WAF managed rule, bot management, country or IP blocking. Then, in [`Security > Security rules`](https://dash.cloudflare.com/?to=/:account/:zone/security/security-rules):

- exclude verified bots from broad blocking rules, for example by adding `and not cf.client.bot` to the expression;
- for a managed rule false positive, create an exception targeting the path rather than disabling the ruleset;
- review country blocks: a blocked country may contain crawler addresses.

Bot Fight Mode, however, cannot be bypassed by a custom rule or an exception rule, according to Cloudflare's documentation: if it gets in the way of crawlers you want to let in, turn it off in [`Security > Settings`](https://dash.cloudflare.com/?to=/:account/:zone/security/settings), “Bot traffic” filter. See [check CDN, WAF and anti-bot protection](https://checklist-seo-geo.com/en/crawling/check-cdn-waf-anti-bot-protection) and [check Cloudflare and the WAF for AI crawlers](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/check-cdn-cloudflare-waf).

### AWS

Versions: AWS console (Amazon S3, CloudFront with origin access control, AWS WAF), November 2026.

**S3 behind CloudFront**: a missing object returns `403 AccessDenied` if CloudFront does not have permission to list the bucket. Add `s3:ListBucket` on the bucket ARN in the policy, next to `s3:GetObject` on the objects:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "LectureCloudFront",
      "Effect": "Allow",
      "Principal": { "Service": "cloudfront.amazonaws.com" },
      "Action": ["s3:GetObject", "s3:ListBucket"],
      "Resource": [
        "arn:aws:s3:::NOM_DU_BUCKET",
        "arn:aws:s3:::NOM_DU_BUCKET/*"
      ],
      "Condition": {
        "StringEquals": {
          "AWS:SourceArn": "arn:aws:cloudfront::123456789012:distribution/IDENTIFIANT"
        }
      }
    }
  ]
}
```

Missing objects then return 404. **AWS WAF**: in the [console](https://console.aws.amazon.com/wafv2/homev2), the web ACL's sampled requests show which rule blocked the request. Managed rules such as Bot Control can block crawlers you want to let in: switch the rule at fault to `Count` mode to measure, then add an exclusion. **CloudFront**: check the distribution's geographic restrictions.

### Plesk

Versions: Plesk Obsidian 18.0.

Blocks often come from the web application firewall: `Tools & Settings > Web Application Firewall (ModSecurity)` at server level, and the equivalent setting in the domain's settings. The ModSecurity log gives the ID of the rule to disable for the domain. Also check Fail2ban and the list of banned IP addresses.

### cPanel

Versions: cPanel & WHM 110 and later, Jupiter theme.

- `Security > ModSecurity` lets you disable the module for a domain; the server administrator can exclude a specific rule from WHM.
- `Security > Hotlink Protection`: leave the option allowing direct requests checked and add your domains.
- `Security > IP Blocker`: review the blocked ranges.
- On servers running Imunify360, blocks appear in its interface; ask support if you do not have access to it.

### Shared hosting

You cannot always see the host's firewall. Note the URLs, times and user agents concerned in your logs and send them to support, asking for the rule ID. Check the `.htaccess` file yourself (`Require` and `Deny` directives, user agent lists copied from a tutorial) and the permissions with the file manager.

### WordPress

Versions: WordPress 6.4 to 7.1, Wordfence 7 and later.

- **Wordfence**: `Wordfence > Tools > Live Traffic` shows each block and its reason. Remove legitimate crawlers from the advanced blocking rules and set rate limiting so as not to penalize verified crawlers.
- **Solid Security, All-In-One Security**: the user agent banning and “bad bots” options sometimes include search engine or generative engine crawlers. Review these lists.
- **Membership or content restriction plugins**: check that they apply only to restricted content.
- **Media**: a `.htaccess` file in `wp-content/uploads/` that forbids direct access also blocks images for Google.

### Laravel

Versions: Laravel 10 to 13.

A 403 comes from `abort(403)`, a policy (`Gate`, `authorize`) or a middleware. Check the middleware applied to public routes:

```bash
php artisan route:list --path=blog -v
```

A policy called on a public page for an anonymous visitor returns 403 if it does not accept a `null` user: declare the parameter as nullable (`?User $user`) or remove the authorization from public pages.

## Common mistakes

- **Testing while logged in and from the office**: the page displays for you but not for crawlers. Test logged out, from another connection, and with the URL Inspection tool.
- **Exempting Googlebot on the user agent alone**: the rule lets impersonators through. Use the official IP ranges or your CDN's bot verification.
- **Disabling the whole firewall for one false positive**: exclude the specific rule on the specific path.
- **Returning 403 to limit the rate**: Google advises against it; use 429 or 503 temporarily.
- **Confusing 403 and 404 on S3**: a 403 on a missing object hides simple broken links.
- **Copying a list of “bad bots”** without reviewing it: it often contains crawlers you want to let in.

## Frequently asked questions

### Does a 403 error get a page deindexed?

Yes. Google treats the 403 code like the other 4xx errors, except 429: an already indexed URL that returns 403 is removed from the index, and a new URL returning 403 is not indexed. If the page is public and must be found, identify the rule that produces this refusal, fix it, then request a new crawl with the URL Inspection tool in Search Console.

### Why does Googlebot get a 403 when the page displays in my browser?

The refusal probably targets a characteristic of Googlebot that you do not share: its user agent, its data center IP addresses, its country of origin or the absence of cookies and JavaScript. A web application firewall, an anti-bot protection or a country blocking rule are the usual causes. The CDN's security events and the server logs show which rule made the decision.

### Should I return 403 to AI crawlers I do not want?

You can, but start with robots.txt for the crawlers that respect it: the rule is public, easy to read and easy to change. A 403, applied by the server or the CDN, is for crawlers that ignore robots.txt. It must target identified crawlers, ideally by their official IP addresses, and never through a generic rule that would also hit the search crawlers you want to let in.

### What is the difference between a 401 error and a 403 error?

The 401 code means that authentication is required and is missing or has failed: the client can try again with credentials. The 403 code means that the server understood the request but refuses to fulfill it, whatever the authentication. For a members-only page, a 401, or a redirect to the login page, is more accurate; for a permanent refusal, a 403.

## Resources

- [Google: How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes?hl=en)
- [Google: Verifying Googlebot](https://developers.google.com/search/docs/crawling-indexing/verifying-googlebot)
- [MDN: 403 Forbidden](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403)
- [Apache: Access control with mod_authz_core](https://httpd.apache.org/docs/2.4/howto/access.html)
- [Cloudflare: 1xxx errors](https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/)
- [AWS: Troubleshoot 403 Access Denied errors from Amazon S3](https://repost.aws/knowledge-center/s3-troubleshoot-403)

Next steps: [fix excessive 429s](https://checklist-seo-geo.com/en/http-redirects/fix-excessive-429s) and [check automatic blocking and CAPTCHAs](https://checklist-seo-geo.com/en/ai-crawler-access-data-policy/check-automatic-blocking-captchas).
