- Issue created by @amanire
We recently received a recommendation from our SEO consultant that our URL shortener should be returning 301 "Moved permanently" responses instead of 302 "Found". I believe that this is intended to improve the SEO ran of the destination pages.
Looking through the issue queue, I learned that this module was originally designed in Drupal 6 to use 301 redirects and that in Drupal 7, this decision was reiterated several times.
https://git.drupalcode.org/project/shurly/-/blob/6.x-1.x/shurly.module?r...
I am guessing that the 302 redirect was accidentally introduced by relying on the default Symfony RedirectResponse
behavior rather than passing in a 301 status code.
See https://git.drupalcode.org/project/shurly/-/commit/a14c890eec9d37c8647cb...
Run the following command from a terminal:
curl -I https://example.org/abcd
Observe the following response:
HTTP/2 302
Use $status = 301
when creating the redirect response.
If the 302 response is intentional and this behavior should not be changed, the rationale should at least be documented.
Active
1.0
Code