The MU forums have moved to WordPress.org

bbPress + WPMU Deep integration? Google might not be indexing your forum pages (2 posts)

  1. rebootnow
    Member
    Posted 14 years ago #

    I have deep integration with bbPress 1.0.2 and WPMU 2.8.4a. I also have the BuddyPress 1.0.3 plugins installed.

    I discovered via Google Webmaster Tools that although my forum pages were loading ok in the browser, they had a 404 status code in the header. Using Firebug and http://web-sniffer.net/ I also found other forums with deep integration that had the same issue (e.g. the forums at buddypress.org).

    The cause? It looks like Wordpress is setting the 404 because it doesn't recognize the bbPress page that is loading. When the global WP object is constructed, the function WP->handle_404 calls "status_header( 404 )".

    As a workaround, I modified "handle_404" to lay off the 404 if "BB_PATH" is defined (i.e. when a bbPress page is loading). This seems to work ok.

    Here's the new "handle_404" at around line 445 in "wp-includes/classes.php".

    function handle_404() {
    		global $wp_query;
    
    		if ( !defined( 'BB_PATH' ) && (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
    
    			// Don't 404 for these queries if they matched an object.
    			if ( ( is_tag() || is_category() || is_author() ) && $wp_query->get_queried_object() ) {
    				if ( !is_404() )
    					status_header( 200 );
    				return;
    			}
    			$wp_query->set_404();
    			status_header( 404 );
    			nocache_headers();
    		} elseif ( !is_404() ) {
    			status_header( 200 );
    		}
    	}

    I'm not a WPMU expert, so I'd love to know whether you think this is a reasonable workaround. Does it warrant a bug in trac?

  2. rebootnow
    Member
    Posted 14 years ago #

    I got some help on the bbPress forum and think I've sorted this out. I was loading "wp-blog-header.php" for deep integration, but loading "wp-load.php" seems to be better. No more 404 headers in the forum, and the RSS feed problem I had previously is also fixed.

    Thread on bbPress forum:

    http://bbpress.org/forums/topic/deep-integration-google-might-not-be-indexing-your-forum-pages?replies=9#post-57859

About this Topic

  • Started 14 years ago by rebootnow
  • Latest reply from rebootnow