WEBcoast Logo

Auto-redirect on slug change: Default status code

TYPO3 CMS used 307 as the default status code for redirects, both when creating them via the "Redirects" module and when auto-creating them on slug changes. In my opinion this I a kind of odd decision. 307 would make the browser use the same request method, e.g. POST. A POST redirect would issue a warning to user, as the data is sent another URL.

Anyway, we all know, that the default status code in the form when creating a redirect manually can be changed using either a global page TS config

TCAdefaults.sys_redirect.target_statuscode = 301

or by overring the TCA for "sys_redirect" table.

But I also wanted to change the status code for the automatically created redirects. After searching where the auto-creation is (there is a DataHandler hook in the redirects extension), I found out, that you can add a setting to your site configuration:

settings:
  redirects:
    httpStatusCode: 301

Et voilà. The redirects are now auto-created with a 301 status code.