linuxapache.htaccesshttp-status-code-403

ErrorDocument 403 not working on Apache server with custom HTML error page (Forbidden 403 error encountered)


I want my error pages to be costumed. I already have created a html file for the 403 status webpage.

I followed also the correct answer in this article:

https://stackoverflow.com/questions/8703540/custom-error-403-page-php

and this is what my .htaccess looks like:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*) $1.php [NC,L]
AddDefaultCharset utf-8
Options All -Indexes
ErrorDocument 403 /errorPages/error403.html

the path is correct but This is the output I am receiving.

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.

My server is Linux, so I use Apache as the web server.


Solution

  • I figured out the solution; I need to add the 'public_html' folder name before my '/errorPages' folder.

    so it should be:

    ErrorDocument 403 public_html/errorPages/error403.html