Possible quick way to fix corrupted permalinks site-wide
-
Hi there!
I’d like to run something by the WordPress and multi-site experts here to see if a possible solution I found for this vexing problem is sound.
Bit of background first: I am in the last stages of finishing a largish WordPress multisite project (artists-painters association) that includes one main site (lots of pages+posts) and 42 “subsites” which are all branded the same way (same theme + settings) and have the same page and menu structure. The home page of each site is a static page and not the blog.
The only things users can modify/add is the content in the 2 existing pages, posts of course and image galleries using the NextGen plugin. Their capabilities in their own sites is quite severely limited using Justin Tadlock’s Members plugin.
Now, the problem I’ve been running into is permalinks getting corrupted over time which causes the links to blog posts to 404. I’m not sure what I do to cause the issue but the last time it happened I had just added a new site to the network. Soon after doing that I realized that all the permalinks in the entire network stopped working and links to blog posts 404’ed. This is nothing when you just have one site but with over 40 sites (and growing) on the network, having to go to each site’s admin and re-save the permalinks (without changes) to fix it is a royal pain.
After researching the issue I can say that the problem is not related to the .htaccess file and the actual “permalink_structure” option in each site’s wp_00_options table has not changed. So I after reading something I came across Googling the issue, I came to look at the “rewrite_rules” option (serialized) in the same table. You see, I run a local version of that entire multisite network locally to test stuff (plugins, settings changes, etc) and when I backup the live site and restore it locally, permalinks are of course broken. I then found that the one difference I could see between the live site’s settings where permalinks worked and the local one is the “rewrite_rules” option value.
So I did a test using a plugin called “YD Network-wide Options”
https://www.ads-software.com/extend/plugins/yd-wpmu-sitewide-options/
I fixed the permalinks on the template site I use and pushed its “rewrite_rules” option value to all the other sites on the network using the above plugin. Takes about 3 seconds and, after testing 5 or 6 sites where permalinks were broken, they are all working again with no immediately visible ill effects.
So, my questions are: Does this fix seem sound to you and do you think it may break something else? Do you think it works only because all those sites have the same structure or are the settings in “rewrite_rules” general and not dependent on site structure?
Permalinks are working on the live site now but I’d really like to hear some of your opinion on this “fix” before I try it on the live site when permalinks break there.
Thanks very much for reading this entire post but, if this fix works I’ll save a ton of time and I’m quite excited about it ??
- The topic ‘Possible quick way to fix corrupted permalinks site-wide’ is closed to new replies.