1

The company I work for has an enterprise Wordpress site that was acquired from a different company. I don't know if there was a past hack or if it's just accumulated spam or what, but the wp_redirection_404 table has grown to roughly 7GB.

I tried grepping the table for Viagra, Versace, Nike, etc. and got pages of results for each. It's obviously full of junk.

It doesn't appear to be doing anything. In fact, when downloading it locally to work on, I don't even bring that table, and I don't notice anything at all. Also, I do a procedure where I must download from a production site sync back into a staging site. Just the process of downloading and uploading usually takes 1.5 hours. By contrast - on another huge Wordpress site, syncing the database usually takes about 45 seconds.

Do I need this table for anything? Can I just empty it? Any sort of complicated scripting to filter legit values just seems too time consuming at this point, as even loading the sql to look at it can take a couple of minutes. Basically - is there anything in this table that I can't do without?

I'm not looking for anecdotal answers, but someone who really knows or at least has had experience with this exact situation.

Thanks

5

That table is from the redirection plugin, and isn't a part of WordPress Core. Deleting it should have no ill effects as long as you disable the plugin too.

If you wish to continue using that plugin though, I recommend using the plugin authors support at https://wordpress.org/support/plugin/redirection/

| improve this answer | |
  • Thank you for this. I will now begin digging to see if it is being used. It is not obvious unfortunately. – dgo Mar 23 '18 at 19:08
4

This is a LOG table. It logs 404 errors - requests that Redirection could not resolve. The proper way to shrink the table is: change the setting "time to keep logs for" to something shorter than "Forever". Navigate to WP Dashboard / Tools / Redirection / Options / 404 Logs. Choose one of:

No logs
A day
A week
A month
Two months

The next time Redirection gets around to performing its log maintenance, the old records will be deleted from this table. Maybe visit a URL that Redirection has on file to trigger that. Or, just trim the log with SQL:

Select          Now()                    As TodayNow   ;
Select Date_Sub(Now(), Interval 1 Month) As OneMonthAgo;
Select Count(*) As OldRecords From Redirection_404 Where Created < Date_Sub(Now(),Interval 1 Month);
Select       *                From Redirection_404 Where Created < Date_Sub(Now(),Interval 1 Month);
Delete                        From Redirection_404 Where Created < Date_Sub(Now(),Interval 1 Month);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.