Problem
You get a "403 Forbidden" error notice when you try to access your site with a web browser.
Additionally, you might come across items in the error log that look something like this:
[Fri Aug 25 06:43:39 2023] [crit] [client xxx.xxx.xxx.xxx] (13)Permission denied: /home/username/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Cause
Any of the following situations:
- There is no index file in the document root directory, just as there is no index.html or index.php file in the public_html directory.
- Permissions are set incorrectly for either the .htaccess file or the public_html directory:
- The file permissions should be set to 644 for the .htaccess file(read and write permissions for the user, and read permissions for the group and world).
- The permissions for the should be set to 755 public_html directory (read, write, and execute permissions for the user, and read and execute permissions for the group and world). When the “403 Forbidden” error occurs, this often indicates that the permissions for the public_html directory are set incorrectly to 644.
Resolution
First, check to see if the document root directory contains an index page.
Next, confirm that the.htaccess file's file permissions are set correctly. Enter the following command at the command prompt to do this:
chmod 644 ~/public_html/.htaccess
Lastly, make sure the correct file permissions are set for the public_html directory. To do this, type the following command at the command prompt:
chmod 755 ~/public_html