zedbiz
Member
Posted 3 months ago #
Ok this has happened twice, once today and again about two weeks ago.
Would like to know why.
I run a WP multi-site - http://beaconnews.ca
This morning I noticed that all the sites except for the main one -the links to the posts were not working - giving 'Page not Found' errors.
Somehow the permalinks on all the sites (except the core site) had messed up.
I had to go in to each of the 15 sites - go to the permalink settings and click 'Save' to get them to work.
Any ideas on what would cause this?
Thanks
Jack
zedbiz
Member
Posted 3 months ago #
What do you mean by that? How would database corruption make my permalinks change?
Thanks in advance
The 'value' for your permalinks is stored in your database, so re-saving them resets that value. If that's getting corrupted, it would cause this behavior.
It's also possible you have a rogue plugin overwriting things.
zedbiz
Member
Posted 3 months ago #
Ok - I took this site over from a previous person and have cleaned it up significantly.
By that I mean removed about a dozen plugins that were not working correctly or not set up right, or not updated recently.
I am down to 10 core plugins.
Also cleaned up the database - both with tools and by hand as much as I can.
So - my question is - what would the process be to find out what is causing this - whether it is the database or some rogue plugin.
And seeing how it has occurred only twice, over two weeks apart - it is not feasible to shut off all plugins and wait to see if it happens again. Shutting off / removing plugins would make site non-functional.
Thanks again in advance
Do a database optomization while you're at it. Use phpMyAdmin or some SQL tool. It won't hurt.
What plugins do you have installed?
zedbiz
Member
Posted 3 months ago #
I have been using phpMyAdmin to optimize on a regular basis.
Plugins in Beacon News
Advanced Export for WordPress & WordPress MU
Askimet
Cool Video Gallery - Not Activated
GAM Shortcode
Get the Image
Google Analyticator
Google News XML Sitemap
Hotfix - not activated
List Category posts - not activated
Multipost MU
New blog Tempates
Page Tagger - not activated
TwoChop Play - only one site activated - testing
Wibiya Toolbar - only one site activated - testing
WordPress Database Backup - not activated - was causing the server to hang-up
WordPress SEO by Yoast
WP-Cleanup
WP-Optimize
Get rid of WP-Optimize. And WP Cleanup.
If you're running a small single site, they're great, but as soon as your site gets large, you're using PHP to optimize your database. Yes, you can do it. But it's like using a hammer to drive in a screw. You're going to break something, because it's the wrong tool.
Using WordPress to have PHP clean up SQL is going to use more memory than you want, and can cause this.
zedbiz
Member
Posted 3 months ago #
Done,
Anything else I can do to prevent the permalinks from getting messed up in the future?
I'd probably remove Advanced Export for WordPress & WordPress MU and WordPress Database Backup. The export is needed rarely, and the build in WP one usually suffices. Also the backup plugin has the same problem as the Optimize and cleanup. They're playing with the DB, and WP is great for a lot of things but DB management ain't one.
zedbiz
Member
Posted 3 months ago #
WordPress Database Backup I will remove ASAP as I quit using it.
The Advanced Export for WordPress I was using to set up some new sites but have since switched to New Blog Templates - so I can delete it as well.
WordPress MU is an essential part of the site as it is how content is posted from the core site to the other locations (sites).
I thought "Advanced Export for WordPress & WordPress MU" was all one plugin...
Can you link to it?
zedbiz
Member
Posted 3 months ago #
Ok - not reading clear.
Yes that is all one plugin (long name eh?)
I thought you meant Multipost MU to delete.
np,
Jack
Ah, okay :D We're good.
Basically the fewer plugins than muck with wp_x_options the less likely you are to see this.
And REMOVING the plugins (not just disabling) ensures theyr'e not going to run. In case one does naughty things under the covers.
zedbiz
Member
Posted 3 months ago #
OK - it just happened again.
Anyway I can trace what might be causing it.
Thanks in advance
Jack
zedbiz
Member
Posted 3 months ago #
This is my htaccess file contents.
Any problems you see?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
Looks like the standard .htaccess for subfolder installs.
Short of putting a trace on the wp_x_options tables in your DB (which is beyond my DB abilities), I would maybe consider a cron job to wipe out the permalinks and reset them every day?
I know someone had to do that once after upgrading and wrong a plugin for it...
On what kind of server are you running the site? Is the database server local to the file server, or are they on two different boxes? Is there any kind of database replication set up on the database server(s)? Are the database tables set up as the MyISAM type or something else (like InnoDB)?
zedbiz
Member
Posted 3 months ago #
Hi Curtiss - here are my answers;
On what kind of server are you running the site?
CentOS with the latest cPanel/WHM.
Is the database server local to the file server, or are they on two different boxes?
It's a local database.
Is there any kind of database replication set up on the database server(s)?
No there is no replication setup.
Are the database tables set up as the MyISAM type or something else (like InnoDB)?
The tables are MyISAM.
Next time it happens, before "fixing" it, go into the database directly and pull out the row from the options table with the "rewrite_rules" name.
Basically, run SELECT * FROM wp_options WHERE option_name = 'rewrite_rules'.
Note: "wp_options" will be different depending on the particular site with the problem. Like wp_3_options or something.
Then post the resulting option_value. Do this before and after you "fix" the thing, see what the difference is.
Also, before doing a "fix", double check on the .htaccess file. Make sure it's still there. If it's getting deleted or something, then visiting the permalink page would recreate it.
To diagnose a broken site, one must figure out what's broken. A before/after comparison is the only way to figure out what is going on.
zedbiz
Member
Posted 3 months ago #
Ok - happened again this morning.
Checked htaccess before and after - it was still there before and it is identical before and after.
Here are the two option values - from before and after.
http://beaconnews.ca/test/option-value-1.txt
http://beaconnews.ca/test/option-value-2.txt
What should I be looking for here??
Thanks in advance.
Your before and after's are exactly the same.
If the rewrite rules are the same, and the .htaccess is the same, then that isn't the problem and your "fix" cannot possibly be working.
zedbiz
Member
Posted 3 months ago #
But it does work.
Not sure why