While accessing non-existing article in WordPress Multisite, it redirects to main page instead of 404 error

Created:

2017-07-18 05:27:08 UTC

Modified:

2017-08-08 13:10:25 UTC

0

Was this article helpful?


Have more questions?

Submit a request

While accessing non-existing article in WordPress Multisite, it redirects to main page instead of 404 error

Symptoms

  • While accessing non-existing article in WordPress Multisite, it redirects to main page instead of 404 error.
  • Custom permalinks are enabled for the site
  • The following directive is set in domain's wp-config.php file:

    # grep NOBLOGREDIRECT /var/www/vhosts/example.com/httpdocs/wp-config.php
    
    define('NOBLOGREDIRECT', 'https://example.com');

Cause

The issue caused by NOBLOGREDIRECT directive and described in details in this article

Resolution

  1. Login Plesk and browse to Home > Domains > example.com > File Manager
  2. In File Manager page open wp-content folder and create mu-plugins directory
  3. In mu-plugins directory create a file custom.php
  4. Click on this file to edit and add the following content:

    <?php
    
    remove_action( 'template_redirect', 'maybe_redirect_404' );
    ?>
  5. Click OK button

Have more questions? Submit a request
Please sign in to leave a comment.