title: Proper code in .htacess file to redirect WordPress HTTP to HTTPS
body: <p>I found a few redirect directives for my Apache Server on different websites. All of them are working fine - but which one is the best? Can anyone explain me which of the following code lines is the best one in terms of performance and logic? The first 3 are very similar. For example:</p>
  <p>V2 uses</p>
  <pre><code>[L,R=301]
  </code></pre>
  <p>and V3</p>
  <pre><code>[R=301,L]
  </code></pre>
  <p>All the codes I found (maybe you have a better one)</p>
  <pre><code>    # V1
      RewriteEngine On
      RewriteCond %{HTTPS} off
      RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
      
      # V2
      RewriteEngine On
      RewriteCond %{HTTPS} off
      RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
      
      # V3
      RewriteEngine On
      RewriteCond %{HTTPS} off
      RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
      
      # V4
      RewriteEngine On
      RewriteCond %{SERVER_PORT} 80
      RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]
  </code></pre>