Multilanguage routing under different paths

Hey there!

We are trying to have a multilanguage kirby installation, which works in different environments.

Locally the site runs under name.test, for pull request previews the site runs under hosting.com/pr-232/, staging is hosting.com/production and production will point the domain to this (our-company.com).

The problem is that enabling multilanguage causes issues in the environments where the site runs under a path, eg /production or /pr-xxx. This causes incorrect URLs like /de/production/home instead of /production/de/home

How can we set up Kirby so that the site runs creates the correct multilanguage paths when it’s hosted in a subdirectory on certain environments?

Thanks in advance for your help!

Have you tried to set the url in domain specific config files?

You could also try to set the RewriteBase in .htaccess.

It might make sense to run this installations under their own subdomains:

pr-xxx.hosting.com
staging.hosting.com
etc.

That way you would avoid this issue.

Thanks I will give these two methods a try! :slightly_smiling_face:

I’ve checked again. We already have set RewriteBase /pr-xxx in .htaccess. And adding url
in config did not make it work.

The errors I’m seeing is that appending the local to the URL shows a 404 instead of the translated page. It works locally when the site is not in a folder.

That’s why I suggested you run your your installations under different subdomains. That should definitely solve your issue.

Just to clarify: So there is no way to run a multi-language kirby website under anything else than the root path?

Using subdomains is unfortunately not easy/possible on most hosting providers.

I don’t know, have never tried that. I guess it is with the right server settings. but I’ll try in a minute.

With the hosting providers I know, you can easily create a subdomain and point it to any folder in the filesystem. But of course, I only know a few.

1 Like

Hey @texnixe! I’ve just found the reason why it wasn’t working. We still had additional redirecting rules in the config for that specific domain. It’s working now :slightly_smiling_face:

Sorry for the confusion!

Ah, ok, great, was just writing that there were no issues on Uberspace with such a config.

1 Like