Project

General

Profile

Actions

Feature #97948

closed

Configurable status code for SiteBaseRedirect

Added by Markus Howald almost 2 years ago. Updated almost 2 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
SEO
Start date:
2022-07-14
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
http redirect code
Complexity:
Sprint Focus:

Description

In TYPO3 11.5. when "https://www.example.com" was entered, but all sites have "https://www.example.com/lang-key/", a redirect to the first possible language is done.

The status code responded is a hardcoded 307 "temporary redirect", but in my opinion, in the situation mentioned above, the status code 301 "permanent redirect" would be more appropriate.

The hard coded status code in /typo3/sysext/frontend/Classes/Middleware/SiteBaseRedirectResolver.php should be configurable in the site configuration.

Actions #1

Updated by Georg Ringer almost 2 years ago

  • Status changed from New to Rejected

Thanks for creating the issue and the detail report!

The discussion 307 vs 301 is endless and as CMS providing a 301 is not something desired because citing the spec:

The 301 (Moved Permanently) status code indicates that the target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs. Clients with link-editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new references sent by the server, where possible.

the important word is "permanently". this means that any browser, cdn or proxy can just return the redirected url without ever asking the server anymore. This is the reason why this won't be changed and why I reject the issue.

However, browsers, seo agencies and users don't follow the specs such closely and a 301 redirect can certainly be changed. As this is just a middleware, I suggest to create a custom extension or ship a custom middleware in your code and use a 307 then.

It would be nice for your usecase to have a configuration but we try to get rid of rare configurations - especially if it can be changed by an API - to have strong defaults and less to maintain, document and maintain.

If you got any questions, feel free to contact me or the team on slack

Actions

Also available in: Atom PDF