Answers.Body: <p>move these lines</p>
  
  <pre><code> RewriteEngine On
  # Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]
  </code></pre>
  
  <p>to the end of the file</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-31T23:14:22.330Z
Answers.Text: it works but it doesn't helps to redirect subdomains to its https versions. I guess there are should be some wildcard in RewriteCond row to redirect all subdomains.
Answers.UserDisplayName: Nikolay Bronskiy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-30T11:35:09.887Z
Answers.LastActivityDate: 2019-01-30T11:35:09.887Z
Answers.UserDisplayName: Flying Car 0013
Body: <p>I'm using Craft CMS 3 multisite installation with more than 20 website based on subdomains.
  There are websites:</p>
  
  <pre><code>website.com
  one.website.com
  two.website.com
  </code></pre>
  
  <p>with identical url paths but different content.
  I need to redirect each website from <code>http</code> to <code>https</code>.
  Root website htaccess:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
  
      # Send would-be 404 requests to Craft
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
      RewriteRule (.+) index.php?p=$1 [QSA,L]
  
      RewriteCond %{HTTP:X-Forwarded-Proto} !=https
      RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
  
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>But this adds <code>index.php</code> to URL while redirects. So <code>http://one.website.com/test</code> become into <code>https://one.website.com/index.php?p=test</code></p>
  
Tags: <craft3><redirect><htaccess><https><ssl>
Title: Force redirect from HTTP to HTTPS via htaccess with multisite installation
ThreadText: # Force redirect from HTTP to HTTPS via htaccess with multisite installation
  
  (Asked by: username_0 on 2018-10-15)
  
  I'm using Craft CMS 3 multisite installation with more than 20 website based on subdomains.
  There are websites:
  
  ```
  website.com
  one.website.com
  two.website.com
  
  ```
  
  with identical url paths but different content.
  I need to redirect each website from `http` to `https`.
  Root website htaccess:
  
  ```
  <IfModule mod_rewrite.c>
      RewriteEngine On
  
      # Send would-be 404 requests to Craft
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
      RewriteRule (.+) index.php?p=$1 [QSA,L]
  
      RewriteCond %{HTTP:X-Forwarded-Proto} !=https
      RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
  
  </IfModule>
  
  ```
  
  But this adds `index.php` to URL while redirects. So `http://one.website.com/test` become into `https://one.website.com/index.php?p=test`
  
  **Tags:** craft3, redirect, htaccess, https, ssl
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-30. Score: 1
  
  move these lines
  
  ```
   RewriteEngine On
  # Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]
  
  ```
  
  to the end of the file
  
  > **Comments:**
  > **username_0**: it works but it doesn't helps to redirect subdomains to its https versions. I guess there are should be some wildcard in RewriteCond row to redirect all subdomains.  
  
  ---
  
  