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 have an individual settings that controls who is allowed to read, write,and execute specified file/directory. When you create new file or folder, default permissions are automatically applied which can be changed later on.

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


What is File Permissions?


There are three types of permissions.

  1. Read
  2. Write
  3. Execute

File permissions can be determined and set through FTP client or from cPanel. At cPanel, you would see file permissions in the form of numbers as follows.

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. Login to cPanel and locate File Manager.

    File Manager

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

    Select File

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

    Change Permissions

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


Default Document is not set


If all permissions are set and even though your website shows 403 forbidden, most likely default page is 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 default document for your website via .htaccess file. You can specify more than one default document for a website.

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

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

Related Articles

What is the maximum number of email disk space I can allocate to a single email account in a Linux shared hosting account?

There is no such limit to allocate the email space for the single email account in Linux shared...

How to change Database Collation in MySQL Server from phpMyAdmin?

Collation is a configuration level setting in the MySQL. It directs how the character data will...

Fix :: FTP Error at FileZilla FTP Client : "Could not connect to server"

Problem Statement Getting an error after initialization of TLS in FileZilla Error Message FTP:...

MySQL : Access denied for user 'Mysql_dbuser'@'localhost' (using password: YES) in /home/cPanel_user/public_html/file path.php

You may face this error while using mysqli_connect function on your website. Cause : This may...

What is the URL to access my webmail?

For our Linux users, the webmail URL is https: //www.<yourdomainname.com>:2096. For our...

  • 1 Users Found This Useful

Was this answer helpful?