WordPress.org

Support

Support » How-To and Troubleshooting » Custom 404 error page

Custom 404 error page

  • Hi,

    I have wordpress installed on my website and currently when a user gets a 404 error it redirects to the 404 message in the blog.

    I’d like to have the 404 page outside of the blog in a file called notfound.php but my attempts so far have just broken the blog.

    Can anyone help me with the .htaccess code required please.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sorted this now.

    WordPress already has it set up to go to a 404.php file so I just edited that with the code I wanted.

    Not quite: if you call http://www.playoutintelligence.com/asdasdasdasd, the 404 page will not redirect to http://www.playoutintelligence.com/404.php

    Maybe it’s also possible to check in the root index.php file whether is_404(), and then call <?php header("notfound.php", true, 404); ?>

    The reason why I suggest to look at the root index.php is that I’m not sure if you can call the header(..) function anywhere within a page. If I remember correctly, this has to happen before the <html> tag is written…

    I would, however, definitely recommend using 404.php if the name of the URL is not important to you…

    Cheers, Thorsten

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom 404 error page’ is closed to new replies.