'403 Forbidden' error message

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:

  1. 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.
  2. 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

Was this answer helpful?

Related Articles

How to disable entity tags (ETags)

This article will show you how to stop your website from sending entity tags (ETags) in HTTP...

How to install Apache Tomcat

Apache Tomcat is a well-known and dependable open-source Java web server. Tomcat is a Java HTTP...

How to troubleshoot CGI scripts

If your CGI (Common Gateway Interface) script isn't working, try the following troubleshooting...

How to use keep-alive connections to improve performance

This article explains how to use keep-alive connections to improve performance in Apache. How to...

How to use Server-Side Includes (SSI)

This tutorial will show you how to set up and use Apache Server-Side Includes (SSI) on your...