1

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.

2
  • What’s wrong with just a 404? Commented Feb 8, 2019 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. Commented Feb 9, 2019 at 3:41

2 Answers 2

0

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.

2
  • 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. :) Commented Feb 9, 2019 at 3:43
  • I'm glad it helps :) Commented Feb 10, 2019 at 23:54
0

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.

3
  • 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. :) Commented Feb 9, 2019 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.) Commented Feb 9, 2019 at 3:47
  • Cool suggestions. I like the Xenu idea, Rick. Thank you. :) Commented Feb 9, 2019 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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