title: .htaccess conflict in Wordpress directory
body: <p>I have a htaccess file in the root of my public files on my web server:</p>
  
  <pre><code>Header set Content-Security-Policy: upgrade-insecure-requests
  
  DirectoryIndex index.html index.php parking-page.html
  
  RewriteEngine on
  # Force www
  RewriteCond %{HTTP_HOST} !^$
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTPS}s ^on(s)|
  RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  
  # Force SSL
  RewriteCond %{HTTPS} off
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NE]
  
  Options -Indexes
  
  ErrorDocument 404 https://%{HTTP_HOST}/index.php
  
  # for JWT auth
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
  # end for JWT auth
  </code></pre>
  
  <p>I installed a Wordpress blog on /blog , and Wordpress creates a .htaccess file in that folder:</p>
  
  <pre><code># BEGIN WordPress
  # The directives (lines) between `BEGIN WordPress` and `END WordPress` are
  # dynamically generated, and should only be modified via WordPress filters.
  # Any changes to the directives between these markers will be overwritten.
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /blog/
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /blog/index.php [L]
  &lt;/IfModule&gt;
  
  # END WordPress
  </code></pre>
  
  <p>I notice that, when I visit <a href="http://example.com/blog" rel="nofollow noreferrer">http://example.com/blog</a> , it redirects me to <a href="https://www.example.com/index.php" rel="nofollow noreferrer">https://www.example.com/index.php</a> , while it should go to <a href="https://www.example.com/blog" rel="nofollow noreferrer">https://www.example.com/blog</a> .
  Other pages, for example <a href="http://example.com/contact-us" rel="nofollow noreferrer">http://example.com/contact-us</a>, successfully redirects to <a href="https://www.example.com/contact-us" rel="nofollow noreferrer">https://www.example.com/contact-us</a></p>
  
  <p>Update:</p>
  
  <ul>
  <li><a href="https://example.com/blog" rel="nofollow noreferrer">https://example.com/blog</a> works fine (redirects to <a href="https://www.example.com/blog" rel="nofollow noreferrer">https://www.example.com/blog</a>).</li>
  <li><a href="http://www.example.com/blog" rel="nofollow noreferrer">http://www.example.com/blog</a> is broken (redirects to <a href="https://www.example.com/index.php" rel="nofollow noreferrer">https://www.example.com/index.php</a>).</li>
  </ul>