How to fix the 403 forbidden error

From LemonWiki共筆
Jump to navigation Jump to search

How to fix the 403 forbidden error

Error message[edit]

When I tried to browse the website, I met the following message:

Forbidden
You don't have permission to access this resource.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Troubleshooting process[edit]

Check the SELinux policy if SELinux was enabled[edit]

The result of ls -Zd should contains "httpd_sys_content_t:"

$ ls -Zd /path/to/website/
drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 /path/to/website/

Check the configuration of HTTP server[edit]

Check if home directory exists e.g. /path/to/website/ in the configuration of HTTP server. The folder location of configuration files maybe located on Template:Kdb depends on the HTTP server environment.

  <Directory /path/to/website/>
  ..
  </Directory>

Check the syntax of .htaccess[edit]

Check if the syntax of .htaccess (/path/to/website/.htaccess ) correct.

Example content of log

/path/to/website/.htaccess: Invalid command 'Force', perhaps misspelled or defined by a module not included in the server configuration, referer: http://mywebsite.com.tw/favicon.ico

Root cause: the original syntax was written for another version of HTTP server.

= More detail on HTTP server log[edit]

Log files maybe located on Template:Kdb

References[edit]