New module: HTTP Status Code
HTTP Status Code is a new module to manipulate HTTP status header.
Main reason for doing this module is that in some cases you need to do manual fixes on the server side to create 410 Gone headers for paths that you want to remove from Google search index, with this module active you could setup the paths directly in Drupal.
You can find the the module at drupal.org. Normaly install should be done with composer -
composer require drupal/http_status_code.
The module supports all Headers used by
Symfony\Component\HttpFoundation\Response - with that said - HTTP headers should be used with caution. So make sure what you understand the impact then you manipulate the HTTP Header - like adding a 301 Redirect Header will be real bad when you not have a redirect in place.
If you remove a page, the request for the path of the page normally then gives a 404 not found in the HTTP header - as it should. But Google does not think this really means that the page is gone forever, just temporarily, so to make Google understand it is gone for real, you could set up the path for the path at
/admin/config/http_status_code/http_status_entity and select that the path would throw a 410 Gone header. Then Google removes the path from the search index.
- Automate rules - like if you unpublish a node of certain type you get a an 410 Gone header for the path.
- If you publish the node again, or another node with same path, remove the 410 Gone header for the path.
- PHP unit tests (needed to get module into beta)
- Nice to have: Wildcard support