Forums

MultiSite 404 main domain not working (2 posts)

  1. BackuPs
    Member
    Posted 4 months ago #

    Hi Guys,

    I installed multisite with the subdomain option and not the sub directory.

    I also created the *(asterix) subdomain. Now i have the following problem.

    When i call a page in the main domain which does not exist the call is rerouted to the main domain index page and no 404 is issued.

    However if i do the same on one of the subdomains the 404 on the same theme is issued perfectly.

    Is this a bug in wordpress MultiSite?

    Looking forward to your reply,

    Best regards,
    BackuPs

  2. BackuPs
    Member
    Posted 4 months ago #

    Hmm i solved my own problem.... It was a pitfall caused by turning on the NOBLOGREDIRECT.

    Turning off Allow users to create a subsite.

    WPMS (wordpress multisite) has a cool feature that new users can create new website. So if they search for helloworld.maindomain.com and this one does not exist they are redirected to some nice signup page for creating the newly blog helloworld.

    However if you do not want this you can disable this and your adviced to put a line in your wp-config.php redirecting users instead of the create new blog screen to the main index of the main domain or any other page within that website..... except the 404. The line to add is define( 'NOBLOGREDIRECT', 'http://maindomain.com' );

    But this means that when a page does not exist and a 404 should be generated the 404 is also never reached. So you 404 is disabled by this instructions. It took me some time to figure this out and to solve it.

    The solutions is pretty simple. Just create a folder in your wp-content called : mu-plugins

    in the mu-plugins you just insert a php file name custom.php with this content. Or whatever name

    <?php
    remove_action( 'template_redirect', 'maybe_redirect_404' );
    ?>
    

    Now what happens is that users who call a blog that not exists get redirected to the root of the main domain to the index.php and really 404's are handled like they should be handled.

    so that one is solved and can be taken of the list.

    Best regards,
    BackuPs

Reply

You must log in to post.

About this Topic