Skip to:
Content
Pages
Categories
Search
Top
Bottom

Intermittent 404 and rewrite rules issue


  • dot
    Participant

    @campbellschool

    I am trying to debug an intermittent 404 issue that has been traced to BBPress. I’ve read several other reports about intermittent 404s and BBPress, but none of them are quite applicable to my situation, so I’m creating a new support topic.

    The main page of my website will intermittently load with a 404.The intermittent access issue appears to last between 10 seconds and 3 minutes at a time. When this happens, it’s down for everyone trying to access the site (confirmed while on the phone with hosting service tech support). Other pages on the site appear to load correctly during this time window. Hitting refresh will eventually successfully reload the page correctly.

    I am using Query Monitor to examine the rewrite rules. Here are the results when the page is loading incorrectly:

    Request	account-2/conscious-business-design-dashboard
    Matched Rule	[^/]+/([^/]+)/?$
    Matched Query	attachment=conscious-business-design-dashboard
    Query String	attachment=conscious-business-design-dashboard
    Query Vars	attachment	conscious-business-design-dashboard
    comments_per_page	50
    name	conscious-business-design-dashboard
    order	DESC
    posts_per_page	10
    update_post_meta_cache	1
    update_post_term_cache	1

    Here are the results when the page is loading correctly:

    Request	account-2/conscious-business-design-dashboard
    Matched Rule	(.?.+?)(?:/([0-9]+))?/?$
    Matched Query	pagename=account-2%2Fconscious-business-design-dashboard
    &page=
    Query String	pagename=account-2%2Fconscious-business-design-dashboard
    Query Vars	comments_per_page	50
    name	conscious-business-design-dashboard
    order	DESC
    pagename	conscious-business-design-dashboard
    posts_per_page	10
    update_post_meta_cache	1
    update_post_term_cache	1
    Queried Object	
    Single Page: #225 (WP_Post)

    Here is the most relevant query that is being run during the 404:

    	SELECT wp_posts.*
    FROM wp_posts 
    WHERE 1=1 
    AND wp_posts.post_name = 'conscious-business-design-dashboard'
    AND wp_posts.post_type = 'attachment' 
    ORDER BY wp_posts.post_date DESC 

    Here is the query run when the page successfully loads:

    SELECT wp_posts.*
    FROM wp_posts 
    WHERE 1=1 
    AND (wp_posts.ID = '225')
    AND wp_posts.post_type = 'page' 
    ORDER BY wp_posts.post_date DESC 

    When I look at the BBPress code, I can identify the rewrite rules here:

    	// Rewrite rule matches used repeatedly below
    		$root_rule    = '/([^/]+)/?$';
    		$feed_rule    = '/([^/]+)/' . $feed_slug  . '/?$';
    		$edit_rule    = '/([^/]+)/' . $edit_slug  . '/?$';
    		$paged_rule   = '/([^/]+)/' . $paged_slug . '/?([0-9]{1,})/?$';

    However, all slugs are correctly set in the database, and I can’t figure out how they might be getting corrupted.

    Any suggestions for further troubleshooting?

Viewing 6 replies - 1 through 6 (of 6 total)

  • Pascal Casier
    Moderator

    @casiepa

    Hi,
    I must be missing something, but why do you think this is bbPress related ?
    Pascal.


    dot
    Participant

    @campbellschool

    When BBPress is turned off, the error stops. When it is turned back on, the error starts again.

    Also, the BBPress rewrite rules, especially the root rewrite stub, are the only place in the entire code base that I can find the rewrite rule RegEx fragment.


    laymission
    Participant

    @laymission

    Have you figured this out. I seem to be experiencing quite a similar issue. the website is laymission.net

    The 404 errors seem to disappear for a short amount of time when permalinks are re-saved, but it’s only a temporary fix.

    If it helps, am using the theme “University” and the backbone to the website is Learndash LMS

    Please help.


    dot
    Participant

    @campbellschool

    Yes! It turns out it’s a known issue with Learndash. That link goes to a support log-in for their FAQ, which provides a workaround. To be honest, I only found out about this after stopping using LearnDash, because the problem made the site essentially unusable. So I haven’t tested it for myself.


    laymission
    Participant

    @laymission

    Thanks!

    I’ll test these fixes out and see what happens.


    dot
    Participant

    @campbellschool

    Great, let me know how they work for you! I hope this saves you some of the misery I went through. 😉

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar