As the title says, I would love to know if its possible to redirect to a WordPress page when an url is not found, but show a 404 response code on that page?

I've been playing around yesterday with header status 404 and location to a certain page in my 404.php, but this would always show a 200 response code.

I was wondering if I could do this without modifying the 404.php (only a redirect) and without a plugin.

Is there a tutorial or anything I can follow somewhere? I wasn't able to find this. Thanks in advance!

I tried all sorts of things:

header("Status: 404 Not Found");
header("Location: FULLURL / RELATIVEURL");
get_header(); ?>

But also these as response codes:

header("HTTP/1.0 404 Not Found");

I also tried placing the 404 under the redirect:

header("Location: FULLURL / RELATIVEURL");
header("Status: 404 Not Found");
  • I also tried placing the 404 error codes on the page itself in a custom HTML block
  • I even tried to iframe the page into the 404, but this wasn't the way to go either!
  • 1
    Is your ultimate goal here just to be able to edit the 404 page? Or is the redirect important? Commented Nov 12, 2022 at 9:51
  • Ha Sorry Jacob for my late answer, but yes the redirect is important Commented Nov 14, 2022 at 7:44

1 Answer 1


Have you tried a htaccess rule?

ErrorDocument 404 the-404-page-permalink

(changing the page to the actual URL of the desired page)

Or, does your theme have a 404.php page? If so, create a child theme (so you don't change the theme files which will get overwritten with a theme update) and create your own 404.php in your child theme.

  • A Custom 404.php does not give me (as a newbie) enough options to create the 404 in the same style as my other webpages. For example, I'd love to have a banner, the normal footer etc. Commented Nov 14, 2022 at 7:45
  • Then create your own custom 404 type Page on your site. Use that page's URL in the htaccess command. There are also '404' plugins that you can use. Commented Nov 14, 2022 at 20:42
  • That might be the solution yeah, thanks! Commented Nov 15, 2022 at 11:55
  • It's always polite to 'checkmark' an answer that works for you. Helps others learn things too. Helps your 'reputation' here (and mine). Commented Nov 15, 2022 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.