• Resolved Aehan

    (@aehan)


    So, for the last days I’ve been battling the problem with the Multisite/Network error where the child-site is not working correctly. I’ve done multiple resets, going through a lot of forum threads and at this point most of the links are now purple. I’m new at back-end side of things, and though I find it quite interesting this personal project of mine has to be put online at some point, so as a last resort before jumping back to a simpler setup I’ll ask you guys.

    I’ve tried different .htaccees and sunrise code and the last, updated ones, seems to be a step in the right direction (?). Before I could not access the Admin area for the the new Networks but I can do so at the moment; but posting is not working and the page itself is giving me no content.

    <IfModule mod_rewrite.c>
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([[_0-9a-zA-Z-]+/]*)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(.+)?(wp-(content|admin|includes)/.*) $2 [L]
    RewriteRule ^([[_0-9a-zA-Z-]+/]*)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    
    </ifModule>
    <?php
    if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
      $current_site = new stdClass;
      $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
      $current_site->domain = $domain = DOMAIN_CURRENT_SITE;
      $current_site->path = $path = PATH_CURRENT_SITE;
      if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
      	$current_site->blog_id = BLOG_ID_CURRENT_SITE;
      } elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { // deprecated.
      	$current_site->blog_id = BLOGID_CURRENT_SITE;
      }
    
      $url = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
    
      $patharray = ( array ) explode( '/', trim( $url, '/' ) );
      $pathsearch = '';
      $blogsearch = '';
    
      if ( count( $patharray ) ) {
        foreach( $patharray as $pathpart ) {
          $pathsearch .= '/' . $pathpart;
          $blogsearch .= $wpdb->prepare( " OR (domain = %s AND path = %s) ", $domain, $pathsearch . '/' );
        }
      }
    
      $current_blog = $wpdb->get_row( $wpdb->prepare( "SELECT *, LENGTH( path ) as pathlen FROM $wpdb->blogs WHERE domain = %s AND path = '/'", $domain, $path ) . $blogsearch . 'ORDER BY pathlen DESC LIMIT 1' );
    
      $blog_id = $current_blog->blog_id;
      $public = $current_blog->public;
      $site_id = $current_blog->site_id;
    
      $current_site = _ss_get_current_site_name( $current_site );
    }
    function _ss_get_current_site_name( $current_site ) {
      global $wpdb;
      $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', "site-options" );
      if ( !$current_site->site_name ) {
        $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
    
        if ( $current_site->site_name == null ) {
          $current_site->site_name = ucfirst( $current_site->domain );
        }
    
        wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' );
      }
      return $current_site;
    }
    <?php
    
    $table_prefix  = 'wp_';
    
     /* MULTISITE */
    define( 'WP_ALLOW_MULTISITE', true );
    
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    //define('DOMAIN_CURRENT_SITE', '/');
    define('PATH_CURRENT_SITE', '/');
    //define('SITE_ID_CURRENT_SITE', 1);
    //define('BLOG_ID_CURRENT_SITE', 1);
    
    define('WP_DEBUG', false);
    
    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIE_DOMAIN', '');
    define('COOKIEPATH', '');
    define('SITECOOKIEPATH', '');
    
    /* That's all, stop editing! Happy blogging. */
    
     // Activate sunrise script
    define('SUNRISE', TRUE);
    
    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

    I’m running it locally and have enabled the mod_rewrite and changed AllowOveride to All in the httpd.conf

    Using the WP Multi Network plugin.

    Thanks and have a good day!
    Aehan

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘404 / Subsites not found WP Multi-Network’ is closed to new replies.