Assuming non-existent-page.html
does not exist, and the user is trying to access that page and triggered a 404 error.
Can i show the requested page URL:
http://www.example.com/non-existent-page.html
instead of the error page URL:
http://www.example.com/404.html
Solution:
While looking at Stephen Ostermiller
's answer i knew i was using a relative URL, but i realized it had a missing trailing slash at the end because i was pointing to a directory and not a page. This mostly occurs with some xSP with bad configurations.
Problem
ErrorDocument 404 /error/404 <-- no slash
Fix
ErrorDocument 404 /error/404/ <-- added slash
example.com/404
it will show the requested page URL instead which isexample.com/nopage
.