Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Making Multiple .htaccess files


lucy24 - 4:44 am on Apr 5, 2012 (gmt 0)


Within any given module, commands happen in the order you wrote them. (We're talking redirects here, not core-level "Order Allow,Deny" structures which have their own rules.) But the order of the modules themselves is fixed: all of mod_a, all of mod_b, all of mod_c and so on, no matter what order your htaccess has them in. Even if they're all mixed up, the system handles them one at a time.

Unless it's your own server, you have no control over what executes first, mod_alias or mod_rewrite. You can work it out experimentally-- but then your host goes and upgrades the installation, things come out in a different order, and there go all your Redirects down the tubes. Suddenly your rewritten requests are being exposed to mod_alias redirects when you'd assumed all of that was safely out of the way.

So it's more of a potential danger than an absolute danger. I used both formats myself for several years without collision-- but I never had any Rewrites as such, and the different kinds of rules affected entirely different directories. That is, any given request might meet mod_alias or it might meet mod_rewrite but it could never meet both.

Apache's own docs say that you should never use mod_rewrite when mod_alias will do-- as for a simple, conditionless redirect. But I think they're assuming it's your own installation so you've got complete control over what happens where and in what order.


Thread source:: http://www.webmasterworld.com/apache/4437176.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com