I use the following rules in my
.htaccess to redirect both 404 and 500 errors:
ErrorDocument 404 /404/
ErrorDocument 500 /500/
However, it doesn't always redirect properly. E.g:
https://example.com/Test --> 404 REDIRECT OK
https://example.com/Test/Test --> 404 REDIRECT OK
https://example.com/test.php --> 404 REDIRECT FAILED (It fails as soon as it has the .php extension?).
As shown above, when the url path has a
.php extension, the 404 redirect fails with the error
Primary script unknown as shown below:
[Wed Feb 07 22:44:36.823117 2018] [proxy_fcgi:error] [pid 24747:tid 140368612202240] [client xx.xxx.xxx.xxx:34028] AH01071: Got error 'Primary script unknown'
What am I doing wrong and why is the redirect working properly without the
.php extension and fails when I add the .php extension to the url path? The tested paths are verified to be non-existing.