Redirect Content to Language


i would like to setup Plone 5, so that Content requests, without language specification will be redirected automatically to a default language.

For example a URL request for will be redirected to

Is there any possibility to implement that in Plone directly, without an Apache Rewrite Rule?

When you use Plone with either LinguaPlone (on its latest versions) or in a multilingual site, Plone creates one folder for each language, so you will always have /en/foo/bar like URLs for your english content and /es/foo/bar for your spanish content, the URL /foo/bar will not exist.

You can, if you want, create "Redirect Aliases" so if users go to /foo/bar can be redirected to /en/foo/bar. If this is what you want you have it by default on Plone 5.2 (rc2 as of today) going to Actions -> URL Management submenu of the toolbar, and in previous versions of Plone you can install Products.RedirectionTool add-on.

As an alternative to @erral simple approach you can write an custom error page for the site root, catching 404s and instead redirect to /en/PRIORURL (and there are other implementation paths to get the same as well).

We had a similar problem and basically did it the same way as @jensens described. Just some pointers when choosing this way:

  • You just have to register a browser view named "plone_redirector_view" with your add-on's browser layer to override the default one.
  • As implementation you can inherit from the default implementation.
  • There you just need to override the method called attempt_redirect.

But make sure, to call the inherited method first and if there is a redirect, use this redirection and only otherwise follow with your custom logic. Ignoring this, you will loose Plone's ability to follow redirects (caused by renames or movement of content).

1 Like