Welcome! Log In Create A New Profile

Advanced

Re: 404 problem

Edho P Arief
July 11, 2011 03:04AM
On Mon, Jul 11, 2011 at 1:15 PM, etrader <nginx-forum@nginx.us> wrote:
> I set error page as
> error_page 404 = 404.php;
> or
> error_page 404 = /404.php;
>
> in both cases, it will load 404.php when visiting a non-existent page in
> the main directory as domain.com/not-exist.html; but it will not work
> for domain.com/sub-dir/not-exist.html
>
> How I can set Nginx to redirect to 404.php when visiting any missing
> page?
>

assuming you put that error_page in `location / { ... }` and you have
another `location /sub-dir/ { ... }`, try moving error_page to `server
{ ... }`.

instead of:

server {
location / {
error_page ...
...
}
location /sub-dir/ {
...
}
..
}

use:

server {
error_page ...
location / {
...
}
location /sub-dir/ {
...
}
..
}

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

404 problem

etrader July 11, 2011 02:15AM

Re: 404 problem

Edho P Arief July 11, 2011 03:04AM

Re: 404 problem

etrader July 11, 2011 03:20AM

Re: 404 problem

Edho P Arief July 11, 2011 03:28AM

Re: 404 problem

etrader July 11, 2011 03:36AM

Re: 404 problem

Edho P Arief July 11, 2011 03:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 244
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready