I'm working on a multisite Craft CMS 3 website. When I'll go to www.site-a.com (default) and www.site-b.com this works fine. The correct sites and templates are displayed. But if I'll go to site-b.com (without www) I'll redirected to www.site-a.com. The sites are not multilangual and doesn't have a seperated webroot. I'll point the domains to the same webroot. This is how I'll set it up in the general config:

   'production' => [
        'env'                   => 'production',
        'siteUrl'               => array(
            'default'           => 'https://www.site-a.com/',
            'second'            => 'https://www.site-b.com/'

In my htaccess I'll force to use to the www domain, like this:

    # -----------------------
    # Force www
    # -----------------------
    RewriteCond %{SERVER_ADMIN} !^dev$
    RewriteCond %{HTTP_HOST} !^localhost$
    RewriteRule ^(.*)$ https://www.{HTTP_HOST}.com/$1 [L,R=301,NC]

What I'll do wrong?

Your Answer

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

Browse other questions tagged or ask your own question.