EN · $ USD
Web Hosting and cPanel

403 Forbidden Error: What Causes It and How to Fix It

7 min read Updated: Sunucu Atlas technical team

In short

A 403 Forbidden error means the server understood the request but refuses to allow access. On shared hosting, the most common causes are wrong file or folder permissions, a missing index file, blocking rules in .htaccess, ModSecurity firewall rules and IP blocks. You fix it by identifying the cause in the error log and correcting the related setting.

In this guide
  1. First, narrow down the scope
  2. 1. Check file and folder permissions
  3. 2. Confirm the index file exists
  4. 3. Review .htaccess blocking rules
  5. 4. Check ModSecurity rules
  6. 5. Check IP blocks and security plugins
  7. 6. Review hotlink protection
  8. Not every 403 is a problem
  9. Checklist
  10. Next step: hosting that puts you in control

A 403 Forbidden error tells you the server received and understood your request but won't let you access that resource. Unlike a 404, the file or folder most likely exists; the problem is permission. On shared hosting, this access block comes from one of five places: file system permissions, a missing index file, .htaccess rules, the ModSecurity web application firewall, and IP blocks. Work through them in the order below and you'll usually find the cause within minutes.

First, narrow down the scope

Where the error appears tells you which check to start with:

SymptomLikely cause
The whole site returns 403public_html permissions, missing index file, a rule in the main .htaccess
Only a specific folder or fileThat item's permissions or the .htaccess in that folder
When submitting a form, saving a post or uploading a fileA ModSecurity rule
Only happens to you; loads fine from another networkAn IP block or a security plugin
Only images return 403 on other sitesHotlink protection

Next, open Metrics > Errors in cPanel and read the lines from the moment you got the error. A message in the log such as Permission denied, Directory index forbidden by Options directive, client denied by server configuration or ModSecurity: Access denied with code 403 points directly to one of the steps below. For a detailed look at reading logs, see our guide on cPanel access and error logs. If you start seeing a 500 error instead of a 403 after fixing permissions, the problem is no longer permissions but configuration or code; in that case, follow the diagnostic flow in our 500 Internal Server Error guide.

1. Check file and folder permissions

In Linux, every file and folder has read (r), write (w) and execute (x) permissions for the owner, group and others. For the web server to serve a file it must be able to read it, and to enter a folder it needs execute permission on that folder.

  • Folders: 755 (drwxr-xr-x)
  • Files: 644 (-rw-r--r--)
  • public_html: On cPanel servers this is usually 750 with the web server as its group; don't change this value.

A folder set to 700 or 000, or a file set to 600, is the most common cause of a 403. It typically happens after a bulk upload with an FTP client, extracting an archive, or a security plugin "hardening" permissions. You can fix items one by one in File Manager by right-clicking and choosing Change Permissions, or fix them in bulk via SSH/Terminal:

cd ~/public_html
ls -la
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

These commands only fix what's inside public_html; they don't touch the folder's own permissions. Also check in the ls -la output that the files are owned by your account user; if you see a different owner, open a support ticket to have it corrected.

2. Confirm the index file exists

When a request comes in for a folder like ornek.com/, the web server looks for a default file such as index.php or index.html. If it can't find one and directory listing is turned off (it should be, for security), it returns a 403. The matching log message is Directory index forbidden by Options directive.

  1. In File Manager, check that the folder contains an index file. The files may have been extracted into a subfolder by mistake (for example public_html/site/).
  2. Make sure the file name is lowercase; in Linux, Index.html and index.html are different files.
  3. If your application uses a different main file, define it in .htaccess:
DirectoryIndex index.php index.html

Turning on directory listing makes the 403 go away, but it shows the folder's contents to everyone. Always add an index file instead.

3. Review .htaccess blocking rules

.htaccess defines access rules per folder. Lines added by a plugin or a previous developer may be blocking all visitors. Look for these patterns:

# Apache 2.4 syntax
Require all denied

# Legacy syntax
Order deny,allow
Deny from all

# Lines that block specific IPs
Deny from 203.0.113.0/24
Require not ip 203.0.113.10

For a quick test, show hidden files in File Manager, rename .htaccess to .htaccess.bak and refresh the page. If the error goes away, add the file back line by line to find the faulty rule. Don't forget .htaccess files in subfolders too; for example, a rule inside wp-content/uploads can block only images. For correct redirect and rule syntax, see our guide on 301 redirects with .htaccess.

4. Check ModSecurity rules

ModSecurity is a web application firewall (WAF) that scans incoming HTTP requests against rule sets. It stops requests that look like SQL injection or XSS with a 403. Sometimes legitimate requests get caught too: saving a blog post that contains a code snippet, submitting a form with certain words, or updating a complex section in a page builder.

  1. Find the ModSecurity: Access denied with code 403 line in the error log and the [id "..."] rule number next to it.
  2. In cPanel, open Security > ModSecurity.
  3. To confirm ModSecurity is the cause, turn it off briefly for that domain and repeat the same action.
  4. If the action works, turn ModSecurity back on right away and open a support ticket with the rule number, asking for only that rule to be exempted for your domain.

Leaving ModSecurity off permanently exposes your site to real attacks; the goal isn't to tear down the whole wall but to make an exception for one faulty rule.

5. Check IP blocks and security plugins

If the site loads from another network (for example, over mobile data) but returns 403 at your office, your IP address is blocked somewhere:

  • cPanel IP Blocker: Check the addresses listed under Security > IP Blocker and remove your own IP.
  • IP rules in .htaccess: The Deny from and Require not ip lines shown above.
  • WordPress security plugins: A plugin may have locked out your IP after failed login attempts. You can disable it by temporarily renaming its plugin folder.
  • CDN/proxy firewall: If there's a CDN in front of the domain, check its security event logs for blocks as well.

If you suspect the server firewall has blocked your IP (and you can't reach cPanel either), include your IP address in a support ticket; the block has to be removed on the server side.

Security > Hotlink Protection in cPanel stops your images from being displayed directly on other sites. If you don't add both the www and https versions of your own domain to the allowed URLs list, images on your own site can return 403 too.

Not every 403 is a problem

Some 403 responses are generated on purpose and protect your site. When reviewing logs, it's normal to see 403s in the following cases; don't remove these rules:

  • Direct access attempts to sensitive files such as .env, wp-config.php, the .git folder or backup files (.sql, .zip).
  • Attempts to run PHP files in upload folders like wp-content/uploads. Blocking PHP in these folders is a common safeguard against malware uploads.
  • Security rules stopping bots' mass attempts against wp-login.php or xmlrpc.php.

An example .htaccess rule to protect sensitive files:

<FilesMatch "^(\.env|wp-config\.php|.*\.sql)$">
  Require all denied
</FilesMatch>

The key question is: are real visitors and you getting the 403, or only suspicious requests? If it's only the latter, your security layer is working correctly.

Checklist

  1. Read the error log and note the source of the 403.
  2. Set folder permissions to 755 and file permissions to 644.
  3. Confirm the index file is in the right folder with the right name.
  4. Test by disabling the .htaccess file.
  5. Briefly test ModSecurity and request a rule exception.
  6. Check IP Blocker, security plugin and hotlink settings.

Next step: hosting that puts you in control

To fix a 403 error quickly, you need access to permissions, the .htaccess file, and ModSecurity and IP Blocker settings from a single panel. Sunucu Atlas cPanel web hosting plans give you all of these tools in cPanel and include LiteSpeed Web Server and free SSL. For a small brochure site, the SA-CP-2 plan is a good start; if you manage several sites and want to keep a regular eye on access and error logs, the SA-CP-5 plan is a better fit. Include the rule number from your error log or the blocked IP in a support ticket in Turkish, and the investigation starts right there.

Frequently asked questions

What's the difference between 403 Forbidden and 404 Not Found?

A 404 means the requested file couldn't be found on the server. A 403 means the resource most likely exists but access hasn't been granted.

Why do I get a 403 error when saving a post in WordPress?

This usually happens because ModSecurity mistakes a code snippet or phrase in the post content for an attack. Find the ModSecurity rule number in the error log and open a support ticket asking for an exception for that rule.

Will setting file permissions to 777 fix a 403?

No, and it isn't recommended. Files with 777 permissions are a security risk and usually cause a 500 error on shared hosting; use 755 for folders and 644 for files.

The site returns 403 only on my computer. What should I do?

Your IP address may be blocked by cPanel IP Blocker, a security plugin or the server firewall. Find out your IP address and remove the block, or include it in a support ticket.

Why am I getting a 403 on a site I just uploaded?

Most likely the files were extracted into a subfolder instead of public_html, or the index file is missing. Move the files to the right folder and check that an index.php or index.html file is there.

For this guide

Recommended plans

With Sunucu Atlas web hosting, you manage permissions, the .htaccess file, ModSecurity and IP Blocker settings in cPanel, so you can find and fix the source of a 403 error yourself.

SA-CP-1

cPanel
Recommended

20 GB NVMe disk

$0.39/mo

+VAT

  • Memory1 GB
  • LocationIstanbul
  • 1 Hosted Domains
  • 50 GB Traffic
  • 5 Email Account Limit
  • 2 Databases

SA-CP-2

cPanel

40 GB NVMe disk

$0.69/mo

+VAT

  • Processor2 cores
  • Memory2 GB
  • LocationIstanbul
  • 1 Hosted Domains
  • 100 GB Traffic
  • 10 Email Account Limit
  • 5 Databases

SA-CP-3

cPanel

60 GB NVMe disk

$0.98/mo

+VAT

  • Processor3 cores
  • Memory3 GB
  • LocationIstanbul
  • 1 Hosted Domains
  • 200 GB Traffic
  • 25 Email Account Limit
  • 10 Databases

Web Hosting — all plans

Need help with setup?

Send questions about your service in a support ticket, and our technical team will walk you through it step by step.