How to do custom 404 page

404 if not found plugin is shows a default “404 not found” error page.
But what if i need to my /404.php page shown?
it’s set in nginx config and work well with /*any page that dont exist*.php

Replace the $notfound = .... part with include path/to/404.php

1 Like

So should the function look like this?

function custom_404() {
    yourls_status_header(404);
    $notfound = include /404.php;
    die($notfound);
}

it doesn’t work for me

Yeah, well, I assumed you had basic PHP knowledge. You should have something like:

function ozh_404_if_not_found() {
    yourls_status_header(404);
    include("/full/path/to/404.php"); // quotes, and full path
    die();
}

Heh, now it’s work, but without first slash in path. Thanks (´・ᴗ・ ` )