Saturday, April 9, 2022

[SOLVED] Apache is trying to serve noindex.html but errorhandler for 403 is set different?

Issue

So i have just set new Error Handlers in httpd.conf for custom error pages:

Alias "/error" "/var/www/error/"
    ErrorDocument 400 /error/error.php?code=400
    ErrorDocument 401 /error/error.php?code=401
    ErrorDocument 403 /error/error.php?code=403

But when i am trying to reach my forbidden subdomain (index.php) i get this:

You don't have permission to access / on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

But if i try the subdomain/jskldfjkd (and subdomain/forbiddendic/ also) it gives the correct error page. In the error logs Apache sais it searches for noindex.html. How can i solve this?


Solution

In welcome.conf was standing the following:

<LocationMatch "^/+$">
    Options -Indexes
    ErrorDocument 403 /error/noindex.html
</LocationMatch>

I removed it, and now it works :)



Answered By - user1226868
Answer Checked By - David Marino (WPSolving Volunteer)