Mobile app version of vmapp.org
Login or Join
Gretchen104

: Htaccess execution order and priority Can anyone explain to me in what order apache executes .htaccess files residing in different levels of the same path and how the rewrite rules therein are

@Gretchen104

Posted in: #Apache #Htaccess #ModRewrite

Can anyone explain to me in what order apache executes .htaccess files residing in different levels of the same path and how the rewrite rules therein are prioritized?

For example, why doesn't the rewrite rule in the first .htaccess below work and is the one in /blog prioritized?

.htaccess in /

RewriteEngine on
RewriteBase /
RewriteRule ^blog offline.html [L]


.htaccess in /blog

RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]


PS: I'm not simply looking for an answer but for a way to understand the apache/mod_rewrite internals ... why is more important to me than how to fix this,

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Gretchen104

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sims2060225

You can use RewriteOptions inherit to inherit the rewrite rules of the parent directory. However, the parent directory's rewrite rules will be applied later, as per the documentation on RewriteOptions.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme