Deleted content shows a 404 error code when it should instead be showing a 410 code. Would it not work better to give listings in trash a 410 error so search engines don’t see a lot of 404 errors.
Hi,
Could you please clarify when you delete a listing and you get a 410 error instead of a 404? If so, please note that this is not the case with HivePress, so it is most likely a WordPress-related issue. Also, please disable third-party plugins and customizations (if there are any) and check if this issue persists. If you use a caching plugin, make sure that caching is disabled for logged-in users. If this issue exists, please provide more details (e.g., your actions step by step with screenshots, screencast, etc.). This will help us to reproduce and resolve the issue faster.
What I am trying to say is that it should show a 410 error for deleted listings for seo purposes. Instead of a 404.
If possible, please describe the steps to reproduce the issue. We understand that there’s an incorrect HTTP code, but we need details to reproduce the issue so we know where to check and how to get this code, for example:
- Publish a listing, then move it to Trash.
- Visit the listing page by URL, check the HTTP code.
Please let me know if these are the correct steps and where should be check the code, when we test deleting listings locally there’s a standard “Page not found” (404) page.
It is correctly showing a 404 code. This is a feature request not an issue. It would be better if it showed a 410 code.
Thanks for the details. The “not found” page HTTP code is handled by WordPress, but we’ll consider replacing it for listings in future updates.
I also found this code snippet that may do the trick if you want to change the HTTP code for 404 pages in WordPress https://stackoverflow.com/a/16953783