Help with multiple rewrites

That’s correct, @pwhodges. The rewrite middleware is called relatively early on in the chain and it picks the first valid (i.e. passes if and regex checks) rewrite rule with the longest base path to execute before passing on to the next middleware.

https://github.com/mholt/caddy/blob/f1eaae9b0d4a6e37882ba2cd38cc842513c502cf/caddyhttp/rewrite/rewrite.go#L48-L55

So strictly speaking, if {uri} not_starts_with /l/ is unnecessary in the above example, but included for readability; since only one rewrite would run, it will either be the first when its conditions are met, or the second otherwise.