Opened 14 years ago
Closed 11 years ago
#16201 closed defect (bug) (invalid)
when updating a multisite blog subblogs getting 404 error
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Multisite | Keywords: | needs-patch |
Focuses: | Cc: |
Description
When I run an update at my multisite, I get 404 error when I try to view a post. This error resolves when I change or update the permalinks at each sub blog. But it is annoying to do so when you have hundreds of sub blogs.
Attachments (1)
Change History (31)
#5
@
14 years ago
I commented to the forum thread. Those rewrite rules look *very* weird.
I think I've seen this before in MU, but I was just never able to reproduce it. It also didn't just happen on upgrade, but that's another story. I ended up just dropping some code in the 404 handler to check if the rewrite rules were corrupted (obvious by the missing /blog/) and set a locking transient then flush the rewrite rules if so.
#6
@
14 years ago
yes the bug is on the forum http://wordpress.org/support/topic/404-errors-after-update-need-to-flush-rewrite-rules-network-wide
I have posted several more information there...
#7
in reply to:
↑ 2
;
follow-up:
↓ 9
@
14 years ago
Replying to garyc40:
You were upgrading from which version to which? 3.0.3 to 3.0.4?
Also, what's the current permalink scheme you're using?
It is not a major or core update, it is just when updating themes or plugins at the root and deploy these into the sub blogs
#8
follow-up:
↓ 11
@
14 years ago
To summarize:
- Rewrite rules
- Broken: http://wordpress.pastebin.com/tUk3Nq5U (verbose)
- Working: http://wordpress.pastebin.com/HSHZp8nx
- Permalink structure
- Main blog:
/%postname%/
- Sub-blog:
/%year%/%month%/%postname%/
- Main blog:
Looks like main blog structure is applied to a sub-blog under some circumstances.
#9
in reply to:
↑ 7
;
follow-up:
↓ 10
@
14 years ago
Replying to yogieanamcara:
It is not a major or core update, it is just when updating themes or plugins at the root and deploy these into the sub blogs
What exactly do you mean by deploying?
#10
in reply to:
↑ 9
@
14 years ago
Replying to SergeyBiryukov:
Replying to yogieanamcara:
It is not a major or core update, it is just when updating themes or plugins at the root and deploy these into the sub blogs
What exactly do you mean by deploying?
I was talkin about the
-> Super Admin -> Update
function at the root.
/wp-admin/ms-upgrade-network.php
#11
in reply to:
↑ 8
;
follow-up:
↓ 12
@
14 years ago
Replying to SergeyBiryukov:
To summarize:
- Rewrite rules
- Broken: http://wordpress.pastebin.com/tUk3Nq5U (verbose)
- Working: http://wordpress.pastebin.com/HSHZp8nx
- Permalink structure
- Main blog:
/%postname%/
- Sub-blog:
/%year%/%month%/%postname%/
Looks like main blog structure is applied to a sub-blog under some circumstances.
Yes, but in regards to your last sentence, even when the main blog has the same permalink structure as it's sub blogs, the sub blogs reporting the 404 errors!
#12
in reply to:
↑ 11
@
14 years ago
Replying to yogieanamcara:
Yes, but in regards to your last sentence, even when the main blog has the same permalink structure as it's sub blogs, the sub blogs reporting the 404 errors!
I guess that's because of the blog/
prefix on the main blog.
#13
@
14 years ago
With the latest update to WP 3.0.5 this issue seems to be solved to me. I do not get any 404 errors after updating (/wp-admin/ms-upgrade-network.php) or updating plugins & themes.
Update: Sorry the bug is still there :(
#14
@
14 years ago
With WP 3.1 it is still the same here, after doing a network upgrade to all my sub blogs I have to manually go to all sub blogs and open the permalink dialog and click on the save button do get rid of the 404 errors.
#15
follow-up:
↓ 17
@
13 years ago
Has this been resolved yet? I have so many blogs in my multi site and updating every single ones permalinks is starting to drive me nuts
Please could you look into this urgently?
#17
in reply to:
↑ 15
@
13 years ago
Replying to arnonel:
Has this been resolved yet?
I took another look at this and still not sure how to reproduce the scenario when a main blog structure is applied to sub-blogs on network upgrade. My guess it that some plugin is doing something wrong (like calling $wp_rewrite->flush_rules()
out of place).
YogieAnamCara wrote that he's using sub-directory install with the Domain Mapping Plugin. Is this the case for you too?
Can you reproduce it on a clean install?
#18
@
13 years ago
- Cc mariusmandal added
I've been experiencing the same bug in a clean install WP 3.2.1
My sites have been created using the create_empty blog() running in loop. For some reason, the rewrite rules of subpages contain the same structure as the main blog (starting with blog/). After applying a bug-fix, the problem is, at least so far, gone for good.
I've used several tricks, all of which fixes the bug:
- updating permalink settings of all subpages
- manually modified the rewrite_rules in the database (get_option, serialize, str_replace removing 'blog/', unserialize, update option)
- running the script at http://pastie.org/1485455 (and adding the line $wp_rewrites->init(); before flushing
For me it seems that the problem might be within using the create_empty_blog (in a loop).
It might have something to do with the bug (and/or fix) of loop-creating, ref: Ticket #12028
Hope this could help someone finding the bug, and please tell if I could help in any way! That said I'm a WP-noob, but love to help ;)
#21
@
12 years ago
- Cc mgyura added
Any luck with this? For me the issue seems to happen consistently after updating the plugin
"Events Manager"
The plugins on my MultiSite install that call $wp_rewrite->flush_rules(); are:
Events Manager, Gravity Forms Directory & Addon, and WordPress SEO
Please let me know if I can help in any way.
#22
follow-up:
↓ 23
@
12 years ago
- Severity changed from critical to normal
Can anyone reproduce this in an install with no plugins and sites that are created with the Network Admin -> Add Site screen ?
#23
in reply to:
↑ 22
@
12 years ago
- Cc mackensen added
- Version set to 3.5.1
Replying to wpmuguru:
Can anyone reproduce this in an install with no plugins and sites that are created with the Network Admin -> Add Site screen ?
I've just done so with 3.5.1. This was a clean install from a tarball with no plugins and no other users. After adding the new site via Add Site I immediately loaded it and clicked on the "Uncategorized" category, which returned the "this is embarrassing" message. I believe this happens because populate_options() is bringing over the rewrite_rules option from the main site which includes all the blog/etc rules (appropriate for the main site but useless in a subdirectory instance). One method I've found to fix this is to reset the rewrite_rules option immediately after populate_options is done (in the wpmu_create_blog function):
update_option( 'rewrite_rules', array() );
That way the proper rewrite rules get generated on first visit. Hope this helps.
#24
@
12 years ago
- Version changed from 3.5.1 to 3.0
Version number indicates when the bug was initially introduced/reported.
#25
@
12 years ago
- Keywords needs-patch added; reporter-feedback removed
I've reproduced the same result & confirmed that the rewrite rules on the new site are the ones for the main site.
#26
@
12 years ago
I confirm as well that this bug is still present and adding update_option( 'rewrite_rules', array() ); like this seems to fix the issue:
$blog_id = wpmu_create_blog($domain, $path, $title, $wp_user_id, $meta); switch_to_blog($blog_id); update_option( 'rewrite_rules', array() ); restore_current_blog();
#28
follow-up:
↓ 29
@
11 years ago
- Milestone changed from Awaiting Review to 3.7
Related #20171 (not entirely sure it's a duplicate yet, but it's close)
#29
in reply to:
↑ 28
@
11 years ago
Replying to jeremyfelt:
Related #20171 (not entirely sure it's a duplicate yet, but it's close)
Sounds like the exact same issue to me.
#30
@
11 years ago
- Milestone 3.7 deleted
- Resolution set to invalid
- Status changed from new to closed
The issue being described by mackensen and others when creating new sites is a duplicate of #20171. However, the original issue is about broken rewrite rules when upgrading multisite.
The OP's issue was caused by Nextgen Gallery flushing rewrite rules on site upgrade. It used to have a function hooked into `wpmu_upgrade_site` that would call an upgrade routine that would flush rewrite rules. However, the hook runs in the context of the site from which the upgrade is performed (the main site) and so the regenerated rewrite rules were incorrect. Looks like this stuff was removed from ngg in version 1.9.9.
You were upgrading from which version to which? 3.0.3 to 3.0.4?
Also, what's the current permalink scheme you're using?