Answer the question
In order to leave comments, you need to log in
How to fetch URL at 404?
This question arose suddenly ... But how to get the entire URL with a 404 redirect? Those. get the URL from which 404 was rejected ...
Answer the question
In order to leave comments, you need to log in
Do not redirect, but simply give html about a non-existent page.
You can watch the referrer, but not all browsers give it. You can write it in cookies before the redirect.
But I also like the option above.
If 404 needs to be generated exactly by the backend, it is better to do something like this (nginx for example):
fastcgi_intercept_errors on;
error_page 404 /error_not_found.html;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question