Is it possible to force the Bundle to redirect with a locale prefix and a 301 Status Code instead of a 302? It would be great for SEO.
Is it possible to force the Bundle to redirect with a locale prefix and a 301 Status Code instead of a 302? It would be great for SEO.
2
Answers
Quick peak at the code: yes. The permanent redirect happens inside the I18nRouter (and the redirect controller that is called there)
https://github.com/schmittjoh/JMSI18nRoutingBundle/blob/master/Router/I18nRouter.php#L258
You can override the I18nRouter (the match() method should be the relevant bit) and change
$permanent
tofalse
For more information about overriding in Symfony, check https://symfony.com/doc/current/bundles/override.html
You can simply change the response status code in the response listener.