0

I've recently installed Multisite using sub directories and I was wondering if it was possible for the sub directory sites to have their own 404 page?

Currently, any links coming in to the sub directory site that should return a 404 are returning a soft 404 on the main or root site.

EDIT

Thanks to Paul H for his suggestion below. I've created 2 new 404 templates with my 404.php template containing the simple if statement below:

$current_blog = get_current_blog_id();

    if ($current_blog == 2) {
        get_template_part('404', 'subdirectorysite');
    } else {
        get_template_part('404', 'main');
    }
1

The easiest way is to check for get_current_blog_id(); and adjust your 404 template based on the current blog id.

An other option is creating a child theme for every site and adding different page-404 templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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