Support » Networking WordPress » 404 errors after update. Need to flush rewrite rules network-wide

  • After updating our WP multisite from 3.0.1 to 3.0.4 subsites get 404 errors when accessing post and category pages (front page and pages work fine). This forum post identified a solution (resave permalink settings) however we have over 1100 sites where this needs to happen. I’ve looked for plugins that will flush the rewrite rules network-wide but the closest I’ve found is YD Network-wide Options that will flush rewrite rules on new blogs (not existing ones). Any ideas?

Viewing 15 replies - 16 through 30 (of 33 total)
  • Can I download the plugin anywhere?

    Didn’t know I violated the Forum Rules so here is the code:

    In your wp-content directory, create a folder called mu-plugins. Create a PHP file with the code from above upload it mu-plugins. This will automatically execute the plugin when someone visits the site (the dashboard – i think). Once its executed, just remove the file and you’ll be good to go.

    Thank you so much!

    How does the plugin work and what will it do?
    Why to remove it after visiting the dashboard?
    Do I need to visit the roots dashboard or each dashboard of any sub blog?
    Will this be implemented in the future updates of WP?

    Sorry for asking you so much!? 🙂

    The plugin works by grabbing all of your blogs, “switching” to that blog and flushing the rewrite rules for the blog, then “switching” back to the current blog you’re logged into. It does this to EVERY blog on your MS network.

    The plugin runs automatically (mu-plugins = Must Use Plugins) when one of your sites dashboards are visited. Once this happens, the plugin will loop through all of your blogs and flush the rewrite rules automatically. Therefore no need to visit each sub blog individually. Also, that plugin updates the site url to include https prefix, if you do not need that, delete lines 19 and 20.

    I recommend removing the plugin after its ran because if not it will run every time one of you sites has a visitor to the dashboard. So if you had 100 visitors at once that script would loop through all 1100 sites 100 times! Get what i’m saying?

    Im not sure if this will be implemented or not! I couldn’t find a plugin to do it so I had to write one that did. I will however polish it a little more and submit it in hopes of it being included in future versions or as a downloadable plugin.

    BTW – I updated the plugin by adding a filter that will only execute the function when you’re redirected to the dashboard after logging in.

    Again thank you so much!

    I think it would be great to have this as a downloadable plugin. With an option that it only would run if necessary or when clicking on an button at the super admin menu item. Then the https feature could also be set as an option 🙂

    Sorry I’m not aware of any programming skills to that, so I could not help. I’m not even knowing if this would be feasible.


    No problem. I hope this helps for you as it did for me.

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    dscottS3 – Does it do it for ALL sites or just the one visited?

    I mean, if you have 500 sites, you’d still need to hit up all the 500 sites to clear them all, right?

    @ipstenu It will grab every blog in your network and flush all of their rewrite rules. However, you have to execute the plugin by logging into your dashboard – as it is hooked to run when you’re redirected to the dashboard. But to better answer your question – no, you DO NOT have to visit each site separately.

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Excellent 🙂 Thanks.

    Andrea Rennick


    Customer Care at Copyblogger Media and Studiopress

    @yoige – there’s alreayd a plugin similar to this to do mass actions across the network.

    Flush rewrite rules is a low use case. 😉

    @dscotts3 unfortunately it seems not to work for me, I also tried to remove the filter so it executes any time I load the dashboard, but after an update of any kind of plugin I get those 404 errors on my sub blogs.

    @andrea_r mhmh what are the power tools do? Do they include a flush of the rewrite rules?

    @yogie I’ve modified the code just a bit. You can find the updated code below. I had to modify for another instance of WP MS that I manage. It may or may not work. Just thought I’d throw it out there anyway…

    Another thing that I noticed is that an affected sites dashboard index has to be visited before it will rewrite flush will take place. IDK why, but this happened to me this time around.

    Moderator Sergey Biryukov


    WordPress Dev

    Trying to summarize on the ticket:

    Any more information about my host for example that would help? Or which plugins I have installed? That would help?

    The list of plugins would probably help. Have you tried disabling them before update to eliminate as a possible source?


    I’m sorry the new code seems not to work for me either!

    I’d seems that the bug has been solved with the 3.0.5 version!

Viewing 15 replies - 16 through 30 (of 33 total)
  • The topic ‘404 errors after update. Need to flush rewrite rules network-wide’ is closed to new replies.