Why am I seeing a 403 Forbidden error message?


Browse by products and services

  • Applies to: Grid
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: FTP client, plain text editor
  • Applies to: All DV
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: FTP client, plain text editor

Last modified: March 5, 2020

What is a 403 Forbidden Error?

The 403 Forbidden error is an HTTP status code which means that accessing the page or resource you were trying to reach is absolutely forbidden for some reason.

This article contains basic troubleshooting instructions for how you can identify and resolve a 403 Forbidden error.

Symptom

You get the following error when you try to visit a web page:

browser1.png


What causes 403 Forbidden Errors?

There are three common causes for this error. Here they are listed from most likely to least likely:

  1. An empty website directory
  2. No index page
  3. Permission / Ownership error

How to Fix a 403 Error Message

Empty html directory

Empty website directory

Make sure that your website content has been uploaded to the correct directory on your server.

  • Grid: /domains/example.com/html/
    • This is the path you will use for FTP. However, the full path to your website content is /home/00000/domains/example.com/html/. The 00000 is your site number. See this article for details.
    • Be sure to replace example.com with your actual domain name.
  • Plesk server: /var/www/vhosts/example.com/httpdocs/
    • When you connect with your FTP user, you just need to navigate into the httpdocs directory.
    • Be sure to replace example.com with your actual domain name.
  • cPanel server: /home/example/public_html/
    • When you connect with your FTP user, you just need to navigate into the public_html directory.
    • Be sure to replace example with the name of your cPanel account username.

If this folder does not exist, feel free to create it.

No index page

The home page for your website must be called index.html or index.php.

To resolve this error, upload an index page to your htmlhttpdocs or public_html directory.

If you already have a home page called something else - home.html for example - you have a couple of options:

  1. Rename your home page to index.html or index.php.
  2. Set up a redirect on the index page to your real home page. See How do I redirect my site using a .htaccess file? for details.
  3. Set a different default home page in your .htaccess.htaccess file. Javascript Kit has a good example.

If you don't want a single page to display, but instead want to show a list of files in that directory, see Making directories browsable, solving 403 errorsMaking directories browsable, solving 403 errors.

Permissions and ownership errors

A 403 Forbidden error can also be caused by incorrect ownership or permissions on your web content files and folders.

Permissions

Rule of thumb for correct permissions:

  • Folders: 755
  • Static Content: 644
  • Dynamic Content: 700

Please see File Permissions for a complete discussion of permissions and security.

TIP:

Linux permissions can be represented with numbers, letters, or words. They also include an entry for Owner, Group, and Everyone.

  • 755 stands for Owner: read, write, execute; Group: read, execute; Everyone: read, execute
  • 644 stands for Owner: read, write; Group: read, Everyone: read
  • 700 stands for Owner: read, write, execute; Group: (none); Everyone: (none)

Most FTP programs allow you to change permissions on a file or folder; see your FTP program documentation for details. You can also change permissions through SSH with the chmod command. See Common SSH CommandsCommon SSH Commands for details.

Ownership

In Linux file structures, every file and folder is assigned to an Owner and a Group. The correct owner and group for your server are as follows, listed like this:

owner:group

  • Grid - note that example.com is your primary domain:
    • /domains/example.com/ - example.com:example.com OR example.com:www-data
    • /domains/example.com/html/ - example.com:example.com OR example.com:www-data
    • /domains/example.com/html/index.html - example.com:example.com
  • Plesk server - note that domainuser is the FTP user for that domain, and example.com is the specific domain in question:
    • /var/www/vhosts/example.com/ - root:root
    • /var/www/vhosts/example.com/httpdocs/ - domainuser:psaserv
    • /var/www/vhosts/example.com/httpdocs/index.html - domainuser:psacln
  • cPanel server - note that example is the name of the cPanel account user
    • /home - root:root
    • /home/example - example:example
    • /home/example/public_html - example:example

You can change file ownership via SSH, using the chown command. See Common SSH CommandsCommon SSH Commands for details.

Resources