title: Why htaccess rules in subfolder stops parent htaccess rules from working?
body: <p>I have the following directory structure</p>
  
  <pre><code>.htaccess
  subfolder
    .htaccess
    file.php
  </code></pre>
  
  <p>/.htaccess contains rules to force ssl on the whole site. /subfolder/.htaccess contains rules to allow accessing php files without their extension. Both rules work, unless used together. If I access <a href="http://example.com/subfolder/file" rel="nofollow noreferrer">http://example.com/subfolder/file</a>, it'll correctly load file.php but it will not redirect to https. What do I need to change in my .htaccess files to make both rules work together?</p>
  
  <p>This is unexpected behavior to me because if I understand correctly, the htaccess in a subfolder runs before the htaccess in the parent folder. But if I paste the force-ssl rules at the end of subfolder/.htaccess then it works as expected. What is causing this behavior difference?</p>
  
  <p>/.htaccess</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  # force https
  RewriteCond %{HTTP:X-Forwarded-SSL} !on
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302]
  </code></pre>
  
  <p>/subfolder/.htaccess</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /subfolder/
  
  # Remove .php extension
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA]
  </code></pre>