title: How to redirect from HTTP to HTTPS in angular
body: <p>I have the following <code>.httaccess</code> for redirect to HTTPS from HTTP page, but it apparently doesn't work as expected:<br></p>
  <pre><code>RewriteEngine On
  # If an existing asset or directory is requested go to it as it is
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
  RewriteRule ^ - [L]
  
  RewriteCond %{HTTPS} off
  RewriteCond %{HTTP_HOST} (www\.)?myuniversity.ro
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
  # If the requested resource doesn't exist, use index.html
  RewriteRule ^ /index.html
  </code></pre>
  <p>The problem is, when I type my actual website like: <br> <a href="http://www.myuniversity.ro" rel="nofollow noreferrer">http://www.myuniversity.ro</a>, it automatically goes to <a href="http://www.myuniversity.ro/home" rel="nofollow noreferrer">http://www.myuniversity.ro/home</a>, like how it supposed to do, but after a refresh is going to HTTPS, is there a way to go into HTTPS from the first attempt? <br> I mean, to go from <a href="http://www.myuniversity.ro" rel="nofollow noreferrer">http://www.myuniversity.ro</a> directly to <a href="https://www.myuniversity.ro/home" rel="nofollow noreferrer">https://www.myuniversity.ro/home</a> without being necessary a refresh?<br>
  This is my route configuration:</p>
  <pre><code>const routes: Routes = [
    { path: '',   redirectTo: '/home', pathMatch: 'full' },
    { path: 'home', component: HomeComponent }
  ];
  </code></pre>