- Issue created by @Charles Belov
If we delete a page or a file and do not intentionally redirect to some other page or file, the website visitor gets a 404 Not Found response. However, if the website visitor had previously viewed this content and was expecting to see it, this could be confusing. It would be better to deliver them to a 410 Gone page and send a 410 status code, allowing us to provide a meaningful explanation to the site visitor as to what has happened. For example, that we are intentionally removing content that is older than our retention period, and providing a link to the retention policy. This also instructs search engines to remove the page or file from their database.
1. Delete a page
2. Attempt to visit the page
Expected result: View a 410 Gone page and receive a 410 status code.
Actual result: View a 404 Not Found page and receive a 404 status code.
3. Delete a file
4. Attempt to visit the file
Expected result: View a 410 Gone page and receive a 410 status code.
Actual result: View a 404 Not Found page and receive a 404 status code.
The following additional steps require the Redirect module:
5. Delete a page
6. Create a redirect to another page
7. Attempt to visit the page
Expected and actual results: View the replacement page.
8. Delete a file
9. Create a redirect to another file
10. Attempt to visit the file
Expected and actual results: View the replacement file.
Add support for the 410 Gone service code:
/admin/config/system/site-information
In the error codes Field group, add support for a 410 Gone page.
Add a database table which tracks pages and files that have been deleted.
Add the following logic (pseudocode) for pages or files which are requested but do not exist:
If the requested URL has a redirect
Do the redirect
Else if the page is in the Gone list
Deliver the 410 Gone page and a 410 status code
Else
Deliver the 404 Not Found page and a 404 status code
End if
Optional: Checkbox to enable support for 410 Gone
If 410 Gone support is enabled, whether for all sites or only for those sites who opt into it:
/admin/config/system/site-information
Under error pages:
Active
11.0 π₯