• Resolved Cyrolancer

    (@cyrolancer)


    Greetings!

    I want to create a network-wide 404 page, regardless of the template of the user’s blog. All 404 errors should redirect to the custom 404 page.

    According to my research on WP Codex, I need to create a 404 page for all themes. In my network, there are a lot of themes and I am searching a way to redirect all 404 errors to my custom 404 page (ex: my-site.com/404.php) without touching any template file.

    How can it be possible?

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter Cyrolancer

    (@cyrolancer)

    Hello again,

    I think I have found a solution. I will explain step by step.

    1. I have created wp-content/mu-plugins/custom-functions.php

    2. I have added the following:

    function check404() {
        if(is_404())
            header('Location: /404.php');
    }
    
    add_filter('404_template', check404);

    inside custom-functions.php file.

    3. I have created 404.php in the site root.

    That is so easy. Sorry for my “post pollution” in the forum.

Viewing 1 replies (of 1 total)
  • The topic ‘Creating a network-wide 404 page’ is closed to new replies.