1

I have a website with 2 languages. Each language is setup as a different site. Each site has its own base URL which is defined as follows: @defaultUrl/en and @defaultUrl/fr.

I have created a new single section which will be the about page with URI /about. This translates to https://mywebsite.com/en/about.

The issue I am encountering is that https://mywebsite.com/about is also a valid URL. How can I make sure that this either throws a 404 or redirects to https://mywebsite.com/en/about? I want the locale to always be present in the URL.

3
  • What do you have in your section's URL path settings? It should give you per-site routing, so that /about should not exist. Commented Sep 19, 2023 at 9:56
  • In the section settings I see 2 rows. 1 for each site and the URI is about. Should I prefix this with something else?
    – Matthias
    Commented Sep 19, 2023 at 11:32
  • Yes! Prefix with each site's locale slug. Then /about should 404. Commented Sep 19, 2023 at 12:53

1 Answer 1

1

Go to your section's settings under Settings > Sections and find the table that lists your Entry URI Formats - you'll have a row for each site. Prefix each path with the site's locale, and then /about should resolve to a 404.

1
  • When I do this I can only access the page on mywebsite.com/en/en/about. This is because the base URL for the site also contains the locale. When I remove the locale from the base URL I can't use the homepage at mywebsite.com/en anymore.
    – Matthias
    Commented Sep 19, 2023 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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