Multisite 404 errors and non-www redirecting to home page

There is currently a bug in the functionality that handles the NOBLOGREDIRECT constant, which causes 404 errors on the main site to be redirected to the value of the constant. Apparently this is the expected behaviour for sub-directory networks (example.com/subsite), but should not take place on subdomain networks (subsite.example.com).

There is a WordPress Trac ticket (#21573) concerning this bug, but there is no indication on when it might be resolved. Until then, you can resolve this error yourself by removing the maybe_redirect_404 function:

remove_action( 'template_redirect', 'maybe_redirect_404' );

This code should go in a .php file in the wp-content/mu-plugins directory. Remember to include a <?php tag at the beginning of the file.

Leave a Comment