Konstantin
Konstantin

Reputation: 1

Apache htaccess ErrorDocument

When I include this if statements in my htaccess file, apache throws Internal Server Error 500:

ErrorDocument 500 /custom_50x.html
ErrorDocument 502 /custom_50x.html
ErrorDocument 503 /custom_50x.html
ErrorDocument 504 /custom_50x.html

<Files "custom_404.html">
    <If "-z %{ENV:REDIRECT_STATUS}">
        RedirectMatch 404 ^/custom_404.html$
    </If>
</Files>

<Files "custom_50x.html">
    <If "-z %{ENV:REDIRECT_STATUS}">
        RedirectMatch 404 ^/custom_50x.html$
    </If>
</Files>

What could be the reason?

The other problem with Apache is that even if a 404 webpage is added to ErrorDocument 404 directive, the status code which the server sends is 200 instead of 404.

The ErrorDocument 50* directives are not working also. Although I have set custom error pages for them, Apache still shows the default errors.

Upvotes: 0

Views: 719

Answers (0)

Related Questions