Nginx 404 redirection to error page

Francis Daly francis at daoine.org
Sat Apr 9 06:30:07 UTC 2022


On Fri, Apr 08, 2022 at 05:44:08PM +0530, Dhanushka Parakrama wrote:

Hi there,

> when it try to access non existing  page such as   https://example.com/abc
> , then  from nginx page correctly get redirect to the
> *https://example.com/page-not-found

> But when i try to access non non-existing page ( with extension )  such as
>  https://example.com/*abc.js  * it does not get redirected to the
> *https://example.com/page-not-found

What is your config? As in:

* in which location{} is the request /abc.js handled? What is the
error_page directive there, and what handler ("something_pass" directive,
usually) is there?

* in which location{} is the request /abc handled? What is the
error_page directive there, and what handler ("something_pass" directive,
usually) is there?

> So is there any way to fix this issue?  , please advice

Maybe "fastcgi_intercept_errors on;" will help, if you are using
fastcgi_pass.

http://nginx.org/r/fastcgi_intercept_errors

Cheers,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list