Force redirect from HTTP to HTTPS via htaccess with multisite installation 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:

&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;


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
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