skip to Main Content

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


  1. 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 to false

    For more information about overriding in Symfony, check https://symfony.com/doc/current/bundles/override.html

    Login or Signup to reply.
  2. You can simply change the response status code in the response listener.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search