title: .htaccess non-www to www and http to https redirects
body: <p>For some reason my redirects are not working. I just want non-www to go to www and non-https to go to https. Here's what I've got. It's from <a href="https://stackoverflow.com/questions/28119684/htaccess-non-www-to-www-and-http-to-https">this post</a>.</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  RewriteRule (.*) https://www.example.com/$1 [R=301,L]
  
  RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  RewriteCond %{HTTP:X-Forwarded-Proto} !=https
  RewriteRule (.*) https://www.example.com/$1 [R=301,L]
  </code></pre>
  
  <p>EDIT: Here is my whole file.</p>
  
  <pre><code># BEGIN WordPress
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  
  RewriteBase /
  RewriteCond %{HTTPS} Off
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  
  RewriteCond %{HTTP_HOST} blog.example.com
  RewriteRule ^(.*)$ https://www.example.com/blog/$1 [R=permanent,L]
  
  RewriteCond %{HTTP_HOST} ^example.com/blog/$ [NC]
  RewriteRule (.*) https://www.exmaple.com/blog/$1 [R=301,L]
  
  RewriteCond %{HTTP_HOST} ^www.example.com/blog/$ [NC]
  RewriteCond %{HTTP:X-Forwarded-Proto} !=https
  RewriteRule (.*) https://www.example.com/blog/$1 [R=301,L]
  
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  # END WordPress
  </code></pre>