I never used Craft before and I'm trying to create a multi-language site (in headless mode) but am running into problems with adding the language to the URL.

My goal is to have URLs that always start with the language, e.g. /en/page and /de/seite. I started by adding that prefix to the base URL of each language site which works fine for querying URLs but not for URIs. I could manually prepend the language to each link but that seems wrong...

What is the recommended way of adding such a language prefix?

  • Adding the prefix to each language site (manually adding the prefix to each link)
  • Adding the prefix to every section (manually adding the prefix for each section).

1 Answer 1


You include the language prefix in each site's URL setting as per the documentation. It's fine that URIs of entries don't include the site URL, this way they stay language-independent. You wouldn't want to have to update all URIs if you need to change the base URL of one site.

If you create site URLs as intended, you will never notice that the language prefix / base URL is added on the fly:

  • Thanks for the response. I'm using Craft in headless mode and with a client-side router which needs the URI. So I would either have to remove the host from each URL or add the language in front of every URI, both of which seem like hacks.
    – Thomas
    Feb 3 at 8:15
  • @Thomas Hm, hard to say in this case, depends on your client-side routing setup. In this case, do you need language prefixes on the server-side at all? You probably already have language prefixes set up in your client-side routing, so I'd pass along the site ID or handle for each entry through the API and build URLs in the frontend based on that. Of course you need to maintain a mapping between site IDs/handles to languages, but that shouldn't be a problem.
    – MoritzLost
    Feb 3 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.