I can't find any documentation on Apache vhosts instructions priority / execution order between
mod_alias
(Redirect
instructions),mod_rewrite
(RewriteRule
instructions)mod_proxy
(ProxyPass
instructions).
Is there any documentation out there about the order these are going to be handled by Apache? Which one takes precedence over the other?
Best Answer
The general rule is that the order of the directives is important. The directive that comes first and matches wins (just like the order of the
VirtualHost
definitions – the first VHost is the default VHost).In most cases it should work fine if you define
Alias
es/Redirect
s andRewriteRule
s first and proxy rules likeProxyPass
last if you want to let redirection take place before your proxy settings apply.http://httpd.apache.org/docs/2.4/mod/mod_alias.html#order
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewriterule
Also see: Apache mod_rewrite Technical Details
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass