title: http to https redirection is not working in angular 6 using htaccess
body: <p>I am trying to redirect my website to <a href="https://www" rel="nofollow noreferrer">https://www</a> using htaccess 301 permanent redirection rules.</p>
  
  <p>I am using the below code in my htaccess file in Angular 6 build version.</p>
  
  <p>Path: <code>/mysite/dist/myfolder/.htaccess</code>  </p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{HTTPS} off [OR]
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule ^(.*)$ https://www.yourwebsite.com/$1 [R=301,L]
  
  
  &lt;IfModule mod_rewrite.c&gt;
      RewriteEngine on
      RewriteBase /
      RewriteRule ^index\.html$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.html [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>The above code works when I open <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a> then it redirects to <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a>. This is fine.</p>
  
  <p>But when I try to open example.com or <a href="http://example.com" rel="nofollow noreferrer">http://example.com</a> then it does not redirect to <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a>.</p>