I have several 404 errors with a URL such as: myWebsite/tag/foo/page/4/. Page no longer exists because a few posts were deleted tagged as "foo." Which is better: 301 redirect that to myWebsite/tag/foo/page/1/? Or just 410 delete them?

I'm thinking if I do a 301 redirect -- then add more posts tagged as "foo," a 4th page will exist but those will be redirected back to page 1. Or if I 410 delete page 4 and it later exists in the future, it won't be found. I'm confused.

  • What’s wrong with just a 404? – Jacob Peattie Feb 8 '19 at 3:05
  • @JacobPeattie, I bought the site recently. There are just too many 404s and am trying to clean the site up without affecting down-the-road pagination issues with the wrong type of redirect. – Andreas3204 Feb 9 '19 at 3:41

This is a tricky one.

The quick and dirty (but correct) solution is to use a 307 temporary redirect and then remove it when the page returns. This way your SEO will not suffer from the 404 errors and search engines will know that the page might come back.

However, if this is something that will happen often, it might be worth while looking at how the theme manages pagination and utilizing wp_redirect() to handle the redirect dynamically.

If you need help with the dynamic route please add a new question referencing your pagination setup.

| improve this answer | |
  • Yes, in many cases, the page will come back. This is what I was looking for. I like your idea on redirecting dynamically via wp_redirect(). Thank you. :) – Andreas3204 Feb 9 '19 at 3:43
  • I'm glad it helps :) – Justin Waulters Feb 10 '19 at 23:54

I'd vote for a general-purpose 404 page, that says something like "That page doesn't exist, sorry." You could even provide a link to a search page.

That type of 404 redirect is easily done via your htaccess file

ErrorDocument 404 /my-404-page

which would redirect to http://www.example.com/my-404-page (an actual WP page that has that as a slug). Adjust as needed for your site.

But my solution doesn't take into account the effect on SEO for your site. And perhaps it would be better to look at your theme code to see why it is returning a page when there is no such page.

| improve this answer | |
  • I have a general purpose redirect almost identical to what you suggested. I bought the site recently and there are hundreds+ of 404s. I'll definitely look into the them, as you suggested. Thank you. :) – Andreas3204 Feb 9 '19 at 3:38
  • You could possibly add code to your 404 page that would save the referring page into a log file, then use that info to find problem links. You might also create a brand-new sitemap.xml file, and submit that to the search engines. And, there are external programs that will look for 'missing links'. I use one called Xenu, which is free...there are others. A 'find-the-missing-links' program could help you clean up the site. (And marking an answer as 'correct' helps others with similar problems, as well as providing encouragement to those that answer questions.) – Rick Hellewell Feb 9 '19 at 3:47
  • Cool suggestions. I like the Xenu idea, Rick. Thank you. :) – Andreas3204 Feb 9 '19 at 5:46

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.