An HTTP 403 Forbidden error means the server understood your request but refuses to let you see the page. Unlike a 404, the resource usually exists. You just don’t have permission to access it. Logging in again rarely helps, because the server has decided this request isn’t allowed.
This guide explains what the 403 status code means, how it differs from 401, and how to fix it. It covers quick checks for visitors, then step-by-step fixes for site owners on Apache, Nginx, WordPress and servers with SELinux.
What Does 403 Forbidden Mean?
The HTTP standard (RFC 9110) defines 403 as: the server “understood the request but refuses to fulfill it.” The server may explain why in the response body, or it may keep the reason to itself.
You may see it as:
403 ForbiddenHTTP Error 403 - ForbiddenYou don't have permission to access this resource.(Apache)403 Forbidden nginxAccess DeniedorError 1020: Access denied(a CDN or firewall)HTTP Error 403.14 - Forbidden(IIS, directory listing denied)
403 vs 401 vs 404
| Code | What the server is saying | Will logging in help? |
|---|---|---|
| 401 Unauthorized | “I don’t know who you are. Authenticate first.” | Yes. See our 401 Unauthorized guide. |
| 403 Forbidden | “I know the request, and the answer is no.” | Usually not, unless you log in as a user with more rights. |
| 404 Not Found | “There’s nothing here.” (Some servers use 404 to hide private pages.) | No. See our 404 Not Found guide. |
Common Causes of a 403 Error
- File or directory permissions: the web server user can’t read the file, or can’t enter one of the parent directories.
- No index file and directory listing disabled: you opened a folder URL that has no
index.htmlorindex.php. - Access rules in the server config:
Require all deniedin Apache,deny allin Nginx, or a missingRequire all grantedfor a new directory. - Rules in
.htaccess: IP blocks, bot blocks or hotlink protection. - SELinux on RHEL-based systems: files have the wrong security label even though normal permissions look fine.
- A firewall or WAF: ModSecurity, Cloudflare or a security plugin blocked the request, your IP or your country.
- Application permissions: you’re logged in, but your user role isn’t allowed to do this.
Quick Fixes If You’re Visiting the Site
- Check the URL. If it ends in
/and points to a folder, the site may not allow folder listings. Look for a link to the actual page. - Reload, then clear the site’s cookies and cache. A stale session can cause a 403 after you log out or your session expires.
- Log in, or log in with an account that has access to that area.
- Turn off your VPN or proxy. Many sites block VPN and data-centre IP ranges.
- Try another network, such as mobile data. Your IP may have been blocked by a firewall after too many requests.
- Contact the site owner with the URL, the time and your IP address if you think you should have access.
How to Fix a 403 Error on Your Own Server
Step 1: Read the error log
The web server always logs why it refused a request. Reproduce the error, then check the log:
sudo tail -n 20 /var/log/apache2/error.logsudo tail -n 20 /var/log/nginx/error.log
On RHEL, Rocky Linux and AlmaLinux, the Apache log is /var/log/httpd/error_log. The message points to the cause:
| Log message | Cause | Go to |
|---|---|---|
(13: Permission denied) (Nginx) or Permission denied: ... because search permissions are missing (Apache) | File system permissions | Step 2 |
directory index of "/var/www/html/" is forbidden (Nginx) or No matching DirectoryIndex ... found, and server-generated directory index forbidden by Options directive (Apache) | No index file | Step 3 |
AH01630: client denied by server configuration (Apache) or access forbidden by rule (Nginx) | Access rules | Step 4 |
Nothing in the log, but ModSecurity or a WAF entry elsewhere | Firewall / WAF | Step 6 |
Step 2: Fix file and directory permissions
The web server user (www-data on Ubuntu/Debian, apache or nginx on RHEL-based systems) needs read permission on files and execute (search) permission on every directory in the path. namei shows the permissions of each part of the path, which makes a missing x easy to spot:
namei -l /var/www/example.com/public/index.html
A common gotcha is a site under a home directory such as /home/user/public_html: many distributions create home directories with mode 700 or 750, so the web server can’t enter them. Fix the ownership and set safe defaults for the site folder:
sudo chown -R www-data:www-data /var/www/example.comsudo find /var/www/example.com -type d -exec chmod 755 {} \;sudo find /var/www/example.com -type f -exec chmod 644 {} \;
Don’t use chmod 777. It opens your files to every user on the server and is never needed to fix a 403. See how to chmod files and directories recursively.
Step 3: Add an index file or allow directory listing
When a request points to a directory, the server looks for an index file. If there isn’t one and directory listing is off (which is the safe default), you get a 403. Add an index.html or index.php to the folder, or check that the server knows about your index file:
# Apache
DirectoryIndex index.php index.html
# Nginx
index index.php index.html;
Only enable directory listing (Options +Indexes in Apache, autoindex on; in Nginx) for folders you really want to share as a file list, such as a download area.
Step 4: Check Apache and Nginx access rules
In Apache 2.4, every directory outside the default web root must be allowed explicitly. If you set DocumentRoot to a new path and get client denied by server configuration, add a Directory block for it:
<Directory /srv/www/example.com>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
In Nginx, look for deny rules in the server block and in included files:
sudo grep -Rn "deny\|allow" /etc/nginx/sites-enabled/ /etc/nginx/conf.d/
Also check .htaccess files in the site and its parent folders for Require, Deny from or RewriteRule ... [F] lines. Temporarily renaming .htaccess is a quick way to test whether it’s the cause. Test and reload after every change:
sudo apachectl configtest && sudo systemctl reload apache2sudo nginx -t && sudo systemctl reload nginx
Step 5: Fix SELinux labels (RHEL, Rocky, AlmaLinux, Fedora)
If permissions are correct but you still get 403, check SELinux. Files that were moved (rather than copied) or created outside /var/www often keep the wrong label:
ls -Z /var/www/html/index.htmlsudo ausearch -m avc -ts recent
Web content needs the httpd_sys_content_t type. Restore the default labels for /var/www, or add a rule for a custom directory:
sudo restorecon -Rv /var/www/htmlsudo semanage fcontext -a -t httpd_sys_content_t "/srv/www(/.*)?"sudo restorecon -Rv /srv/www
Don’t disable SELinux to fix this. See how to configure SELinux for a new Apache directory.
Step 6: Check the firewall, WAF and CDN
If the server logs show nothing, the 403 may come from a layer in front of the application:
- ModSecurity: look for
ModSecurity: Access deniedin the Apache error log or in/var/log/modsec_audit.log. Adjust or disable the specific rule ID that fired, not the whole engine. - Cloudflare or another CDN: an error page branded by the CDN (for example Cloudflare’s
Error 1020) means a firewall rule there blocked the request. Check the security events in the CDN dashboard. - Security plugins such as Wordfence or iThemes on WordPress may block IPs, countries or URL patterns.
- Fail2ban usually drops connections rather than returning 403, but check
sudo fail2ban-client statusif your IP was recently blocked.
Fixing 403 Errors in WordPress
- Reset
.htaccess: rename it, then go to Settings → Permalinks and click Save Changes to generate a clean one. - Disable security plugins by renaming their folder in
wp-content/plugins/, then test again. - Check permissions: 755 for directories, 644 for files, and 640 or 600 for
wp-config.php, owned by the web server user or your deploy user. - 403 in wp-admin only: some hosts block
/wp-admin/orxmlrpc.phpby IP. Check the host’s firewall or your.htaccessrules.
Related HTTP Error Guides
For the full list of codes and what they mean, see our HTTP status codes list. Guides for other common errors:
- HTTP 400 Bad Request
- HTTP 401 Unauthorized
- HTTP 404 Not Found
- HTTP 429 Too Many Requests
- HTTP 500 Internal Server Error
- HTTP 502 Bad Gateway
- HTTP 503 Service Unavailable
- HTTP 504 Gateway Timeout
Frequently Asked Questions
What does 403 Forbidden mean?
It means the server understood your request but won’t allow access to the page or file. The resource usually exists, but you don’t have permission to see it.
How do I fix a 403 Forbidden error as a visitor?
Check the URL, clear cookies, log in if needed, and turn off any VPN or proxy. If it still fails, the block is on the site’s side, and only the owner can change it.
What is the difference between 401 and 403?
401 means you need to authenticate (log in or send valid credentials). 403 means the server knows who you are, or doesn’t need to, and still refuses the request.
Why does my Nginx site show 403 Forbidden?
Most often, there’s no index file in the directory, or Nginx can’t read the files because of permissions or SELinux labels. The Nginx error log shows which one.
Can file permissions cause a 403 error?
Yes. The web server needs read permission on files and execute permission on every parent directory. Use namei -l /path/to/file to find the directory that blocks it.
Conclusion
An HTTP 403 Forbidden error means the server is refusing access on purpose. For visitors, clearing cookies, logging in or switching off a VPN solves most cases. For site owners, the error log names the cause: file permissions, a missing index file, an access rule, an SELinux label or a firewall. Fix that specific cause rather than opening permissions wide, and the page will load again without weakening your server’s security.
How did it make you feel?
