Craft 3 with Multi-Site: how to not set a primary site, or add a first segment to all primary site URLs? I have a main domain, www.mycompany.com, which has several groups of sites, which are available in several languages:

www.mycompany.com/international

www.mycompany.com/sales/en
www.mycompany.com/sales/fr

www.mycompany.com/customers/en
www.mycompany.com/customers/fr

etc.


Once visitor access to www.mycompany.com, he will be auto-redirected to a Site version depending on his IP (probably using a third-party plugin like Country Redirect, once available for Craft 3).

The problem is that when I set up the Sites, Craft force to set a primary Site. So I choose the www.mycompany.com/international version.

But when Site is saved, the Base URL is displayed as www.mycompany.com instead of www.mycompany.com/international, and all URLs in this one are now like www.mycompany.com/my-slug instead of www.mycompany.com/international/my-slug.

This probably can be solved by pre-checking all links, adding the slug inside the URL if current Site id is the www.mycompany.com/international version, then adding a routing rule for all /international/* requests.

But it sounds a bit tricky in the some cases, so I wondered if there was a cleaner way to achieve this?
It looks like you forgot to setup siteUrl in config/general.php for your sites.

'siteUrl' =&gt; [
    'landing' =&gt; 'https://www.mycompany.com/international',
    'sales-en' =&gt; 'https://www.mycompany.com/sales/en',
    'sales-fr' =&gt; 'https://www.mycompany.com/sales/fr',
    ...
],