Find the rule that turned your visitor away

403 Forbidden means the server understood the request and refused to fulfill it, and signing in again won't change the answer. On your own site, something decided the request wasn't allowed: an access rule, a firewall or bot filter, file permissions the web server can't get past, or your app's own permission check. Find which layer sent it, then fix the rule or the permission it acted on.

What can refuse a request with 403

  • A firewall or bot filter

    A web application firewall in front of your site blocks requests that match its rules, such as a suspicious pattern, a country or a client it takes for a bot. Its log shows which rule matched.

  • An access rule on the server

    Server settings can deny addresses, ranges or whole paths. Apache's rewrite rules, for example, send 403 for any request they mark as forbidden.

  • File permissions

    If the user the web server runs as can't read a file, the server refuses the request instead of sending it. IIS is the exception: it reports a file system permission problem as 401.3, unauthorized due to ACL on resource.

  • A folder with no default page

    A request for a folder that has no index page, on a server that doesn't list folder contents, gets a 403. IIS reports this as 403.14, directory listing denied.

  • Your app's permission check

    The app knows who the user is but decides they lack the rights for that page or action, such as a member opening an admin page.

  • A rate limit

    Some servers refuse a client that sends too many requests with 403 instead of 429. IIS uses 403.502 when one address passes its request rate limit.

RFC 9110 defines the status. Microsoft's IIS status code list breaks 403 into causes like these, Apache's access control guide covers its forbidden rules, and Amazon's load balancer guide names a firewall rule as the cause of its 403s.

Compare what different clients get

# Print the status and the software that answered
curl -sI https://yoursite.com/page-that-fails | grep -iE '^(HTTP|server)'

# Ask again with a browser's user agent; a different answer points to a bot filter
curl -sI -o /dev/null -w '%{http_code}\n' -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" https://yoursite.com/page-that-fails

How to tell which layer sent the 403

  • The page that comes with the 403 is the quickest clue. A page in your site's own design came from your app; a plain or unfamiliar page came from a layer in front of it, and the Server header names the software that answered. If curl gets a 403 and your browser doesn't, or the other way around, the rule is judging something that differs between the two clients: the user agent, the other headers and cookies, or whether the client runs JavaScript. From one machine they share an address, so an address rule treats them alike.

  • Then read that layer's log for the minute of the error. A web server's error log usually records why it refused a file, such as a permission failure or a rule that matched. A firewall's event log shows the rule that blocked the request and the address it came from, which tells you whether the rule caught one visitor or everyone.

How to fix a 403 Forbidden error

  1. Find the rule that matchedUse the layer's log to find the exact rule or check behind the 403, rather than turning protection off to test. A firewall rule can usually be narrowed, or given an exception for one path or one client.
  2. Fix file and folder permissionsGive the web server's user read access to the files it serves and access to every folder on the path. Don't make files writable by everyone to fix a read problem.
  3. Put the index page where the server looksIf the 403 is for a folder address, such as the home page, check that the folder holds the index file your server is set to serve and that the deploy copied it there.
  4. Let search crawlers throughIf a filter turns Googlebot away, exempt only addresses that prove to be Googlebot: a reverse DNS name ending in googlebot.com whose forward lookup returns the same address, or an address inside the common-crawlers.json ranges Google publishes. Anyone can copy Googlebot's user agent.

Frequently asked questions

Why does Search Console say blocked due to access forbidden?

Googlebot got a 403, and the status reads Blocked due to access forbidden (403). Google notes that its crawler never sends credentials, so a 403 to Googlebot is a mistake on the server's side. It suggests letting signed-out visitors in, or allowing Googlebot without sign-in once you've verified its requests. The Page indexing report guide describes the status, and Google's verification guide shows how to confirm a request came from Google.

Should a private page return 403 or 404?

Either is allowed. RFC 9110 lets a server answer 404 instead of 403 when it doesn't want to reveal that the page exists, which suits admin areas and other people's private files. Use 403 when admitting the page exists does no harm.

Why do only some visitors get a 403?

Rules that look at the address, such as a country block or a blocklist, refuse everyone behind that address. Visitors on a VPN or a shared office network arrive from the same address as everyone else on it, so a block aimed at one of them reaches them all.