[FEATURE]: Allow "Redirects" with Status Code 410 for deleted files and Pages
Here is a feature idea which would be really nice to have:
I would like to be able to create "Redirects" without a target but with a status code of 410 to signal "This file is Gone on purpose".
I think a good place to create this would be the EXT:redirect, since this is currently the only place where we can define entries with URLs, that are not associated with any data.
- Add the option "410 Gone" to the Status Code Select-Field
- Throw a 410 error if the url is requested
One problem I see with this solution is, that error handling (like 404) is handled in the Site Configuration. But we don't necessarily have a site configuration when we respond to a defined url.
On the other hand, we need a solution where the editors can add those urls via the backend. So it can't be completely done via Site Configuration.
One other possible solution would be to have another module behind a dropdown on top of the redirects module for the 410 Redirects specifically, where you have to select a page on which to create the redirects. That way we would always have a siteconfig and could configure the 410 handling as we do with the 404 handling.
I'm interested in your opinion. As soon as we have a prefered solution I will be happy to provide a patch :)
Updated by Joachim Eckerlin 8 months ago
- Subject changed from [IDEA]: Allow "Redirects" with Status Code 410 for deleted files and Pages to [FEATURE]: Allow "Redirects" with Status Code 410 for deleted files and Pages
Hmm. That's also an interesting idea with the placeholder pages. But I'm not really sure if I think this is a good solution.
This might make the pagetree very messy and would produce a lot of pages without any content, which also don't behave like pages at all. They are not shown in any menus and behave more like folders than anything else. So I think they should also not be shown in the pagetree or at least have to option to hide them by clicking a checkbox. Which means a new feature for the pagetree aswell.
I checked the middlewares, that are called and the site-resolver gets called before the redirect handler. So here is my proposal for this ticket:
- Add a new option "410 Gone" to the error code dropdown for redirects
- Extend the redirect handler to check if we currently have a siteconfig with a configured 410 handler.
- If this is the case and we are currently on a url which has an associated 410 Redirect, call the 410 handler from the site configuration and let it handle the error.
If this is not the case return the error code 410 and cancel the request.
- Optional Add possibility to automatically add a 410 redirect for pages, when they get deleted, like we do for renamed pages already.
This also has the advantage, that we can define files as "Gone" and also use regex for a whole bunch of pages without having to add dozens of placeholder pages.
Updated by Chris Müller 8 months ago
I am a little bit torn about this topic: The status code 410 is semantically correct, when the page is gone forever, where a 404 is "only" a "not found". But it has only minimum relevance for Google:
Yes, a 410 is directly removed from the index, where the 404 is hold back for one or two days (it cannot be found by accident). Also a 410 is lesser crawled again than a 404 (both can come back).
But: An editor (in best case a SEO marketeer) has to choose if a 410 is the correct way when disabling/deleting a page. For the end user which visits the web page it has no relevance if it is gone forever or for another reason (I assume that you want to have different pages for 404 and 410). The information I searched for is not there. Period.
And: Also a 410 page can come back (enabling the page or reusing a slug again - maybe unknowingly).
As John Müller from Google suggests (see Twitter link above), deliver a "great" 404 page.
I don't think the effort is worth it - only to get the page out of search engine index a little bit earlier and to provide an additional error page. Maybe an extension which adds a middleware and a module is the way to go for the people who need this for some reason.