Answers.Body: <p>The problem is that the force ww redirect isn't setup correctly. This must be setup like this:</p>
  
  <pre><code>    # Force www
      # -----------------------
      RewriteCond %{HTTP_HOST} ^domain-a.com [NC]
      RewriteRule ^(.*)$ https://www.domain-a.com/$1 [L,R=301,NC]
  
      RewriteCond %{HTTP_HOST} ^domain-b.com [NC]
      RewriteRule ^(.*)$ https://www.domain-b.com/$1 [L,R=301,NC]
  </code></pre>
  
  <p>Also both domains must point to the same server.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-11T12:44:34.237Z
Answers.LastActivityDate: 2020-03-11T12:44:34.237Z
Answers.UserDisplayName: Maarten Heideman
Body: <p>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:</p>
  
  <pre><code>   'production' =&gt; [
          'env'                   =&gt; 'production',
          'siteUrl'               =&gt; array(
              'default'           =&gt; 'https://www.site-a.com/',
              'second'            =&gt; 'https://www.site-b.com/'
          ),
      ],
  </code></pre>
  
  <p>In my htaccess I'll force to use to the www domain, like this:</p>
  
  <pre><code>    # -----------------------
      # Force www
      # -----------------------
      RewriteCond %{SERVER_ADMIN} !^dev$
      RewriteCond %{HTTP_HOST} !^localhost$
      RewriteRule ^(.*)$ https://www.{HTTP_HOST}.com/$1 [L,R=301,NC]
  </code></pre>
  
  <p>What I'll do wrong?</p>
  
Tags: <multi-site><multi-domain>
Title: Craft multisite site without www redirects unwanted to default site
ThreadText: # Craft multisite site without www redirects unwanted to default site
  
  (Asked by: username_0 on 2020-02-13)
  
  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?
  
  **Tags:** multi-site, multi-domain
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-03-11. Score: 1 | Accepted answer
  
  The problem is that the force ww redirect isn't setup correctly. This must be setup like this:
  
  ```
      # Force www
      # -----------------------
      RewriteCond %{HTTP_HOST} ^domain-a.com [NC]
      RewriteRule ^(.*)$ https://www.domain-a.com/$1 [L,R=301,NC]
  
      RewriteCond %{HTTP_HOST} ^domain-b.com [NC]
      RewriteRule ^(.*)$ https://www.domain-b.com/$1 [L,R=301,NC]
  
  ```
  
  Also both domains must point to the same server.
  
  
  ---
  
  