• I have a WordPress multisite website that should work as a Social Network. I’ve got BuddyPress and some plugins to make it work better and give it functionalities like followers and so on. I’ve a theme too adapted for BuddyPress.

    The problem is: I’ve enabled multisite and just because I don’t want that users can create their own site, I’ve this in wp-config.php:
    define( 'NOBLOGREDIRECT', 'http://website.com' );
    with website.com obviously as my website. This is okay. But when there should be a 404 sever error not found, users get redirected to homepage. So, to fix this, I’ve created the folder mu-plugins in wp-content and I’ve put a .php file called redirectc.php (I’ve call it with the final C because I wanted to avoid any possible compatibility problems). Inside this file, I’ve type:

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

    But it doesn’t work. Even if an user should have a 404 error, so writing website.com/something, the user gets redirected to the homepage. I know that is BuddyPress fault because I tried with every plugin and with every plugin I got works well, this code. But if I have BuddyPress enabled, this happens. I even tried using Twenty Fifteen as default theme (maybe that could have be a theme function problem) but nothing. I reinstalled BuddyPress and the problem persists.
    The .htaccess is the same that WordPress tells me to insert:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    What could I do? Thank you everyone in advance!

  • The topic ‘BuddyPress MultiSite redirect a 404 to noblogredirect value, show 404 instead’ is closed to new replies.