How Do I Fix ‘403 Forbidden Error’?

The '403 Forbidden Error' indicates that your website files have incorrect permissions. Every file/ directory of your website has an individual setting that controls who is allowed to read, write, and execute a specified file/ directory. When you create a new file or folder, default permissions are automatically applied, which can be changed later.

The website root directory, public_html, must have 750; other directories and executable scripts within the cgi-bin folder must have 755 permissions. At the same time, the files (.php, .html, etc.), images, and text files should be 644.

What is File Permission?
There are three types of permissions – 

  1. Read
  2. Write
  3. Execute

File permissions can be determined and set through the FTP client or cPanel. In the cPanel, where you would see file permissions in the form of numbers as depicted below – 

7 ==> Read + Write + Execute
6 ==> Read + Write
5 ==> Read + Execute
4 ==> Read Only
3 ==> Write + Execute
2 ==> Write Only
1 ==> Execute Only
0 ==> Access Denied

Ideal Permissions

Public_html folder ==> 750
Subfolders ==> 755
Any files (.html, .php, media files, images etc) ==> 644
CGI and Perl scripts ==> 755

Permissions Explanation

777 (Not Recommended)

  • Owner :: READ(4) + WRITE(2) + EXECUTE(1) ==>7
  • Group :: READ(4) + WRITE(2) + EXECUTE(1) ==>7
  • World :: READ(4) + WRITE(2) + EXECUTE(1) ==>7

755 (Subfolders)

  • Owner :: READ(4) + WRITE(2) + EXECUTE(1) ==>7
  • Group :: READ(4) + EXECUTE(1) ==>5
  • World :: READ(4) + EXECUTE(1) ==>5

750 (Public_html)

  • Owner :: READ(4) + WRITE(2) + EXECUTE(1) ==>7
  • Group :: READ(4) + EXECUTE(1) ==>5
  • World :: 0

644 (All files)

  • Owner :: READ(4) + WRITE(2)==>6
  • Group :: READ(4)==>4
  • World :: READ(4)==>4

444 (Read Only)

  • Owner :: READ(4)==>4
  • Group :: READ(4)==>4
  • World :: READ(4)==>4

 
How Do I Set Permissions? 

1. Log in to cPanel and locate File Manager.

File Manager

2. In the File Manager, navigate to the file/ directory whose permissions you want to change.

Select File

3. Right-click on the file/ folder and select Change Permissions.
    Here, you can change the permissions for the file/ folder.

Change Permissions

5. Once you have set new permissions, click on the Change Permissions button.

Default Document is not set

If all permissions are set, and your website shows a 403 Forbidden Error, the default page is probably not set for your website. With Windows Hosting, you can configure the default document for the website or a virtual directory from WebsitePanel

With Linux Hosting, you can set the default document for your website via the .htaccess file; you can specify more than one default document for a website.

When you browse any website, a web server (Apache or IIS) searches for the default documents in the order they are listed. Then, the web server displays the next default page from the list if the first default document is unavailable.

If the web server cannot find any match and a directory listing is enabled, then the web server displays the list of folders. If the directory listing is disabled, the web server will return an HTTP Error 403 - Forbidden message to the browser.

 


Was this answer helpful?

« Back

chat