Forum Moderators: phranque

Message Too Old, No Replies

Priority of Local vs. Root Mod_Rewrite

In what order are they followed

         

Philosopher

4:55 pm on Mar 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A few days ago I posted a question in regards to a subdomain/mod_rewrite issue I was having.

It turns out that the issue is most likely caused by the way my host handles subdomains. They have given me their root mod_rewrite rules to look over so I can see if I can find the cause.

The biggest question I have is in what order are the mod_rewrite rules followed? Are the root rules followed then the local? Or are the local rules followed then the root?

closed

6:36 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



Generally speaking, the latter.

jdMorgan

12:40 am on Mar 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, to be very specific, the Web root .htaccess is acted upon first, and then the lower-level .htaccess files are acted upon in the order that their subdirectory names appear in the URL. Code in a lower-level .htaccess file can override the effects of a higher-level .htaccess file, but only if the lower-level .htaccess file is processed and not bypassed because of the action of the higher-level file and, in the case of mod_rewrite, only if the URL still matches the expected pattern in the lower-level .htaccess file.

So, execution order is top-to-bottom, and "priority" is bottom-to-top.

Jim