On 27 Jan 2014, at 12:11 AM, GRAHAM LEGGETT <minf...@sharp.fm> wrote:
> A look at mod_alias shows it has 7 directives: > > • Alias > • AliasMatch > • Redirect > • RedirectMatch > • RedirectPermanent > • RedirectTemp > • ScriptAlias > • ScriptAliasMatch > > In theory we only need these three: > > • Alias > • Redirect > • ScriptAlias > > What I'm keen to do is enable expression support and deprecate all but the > above, with the following as the preferred configuration method (same as the > one used by ProxyPass): > > <Location /foo> > Alias /var/lib/bar > …stuff... > </Location> > > or > > <LocationMatch ^/foo/(?<bar>[^/]+)> > Alias /var/lib/%{env:MATCH_BAR}/baz > …stuff... > </LocationMatch> > > In theory this would be faster as we would not be scanning the list of > Aliases followed by the list of Locations each time, and things get a lot > simpler to use. This patch implements the above. The idea is that the existing syntaxes remain unaltered (and can be deprecated in future), while we introduce new Location syntaxes with a single argument, like so: <Location /image> Alias /ftp/pub/image </Location> <LocationMatch /error/(?<NUMBER>[0-9]+)> Alias /usr/local/apache/errors/%{env:MATCH_NUMBER}.html </LocationMatch> <Location /one> Redirect permanent http://example.com/two </Location> <Location /three> Redirect 303 http://example.com/other </Location> <LocationMatch /error/(?<NUMBER>[0-9]+)> Redirect permanent http://example.com/errors/%{env:MATCH_NUMBER}.html </LocationMatch> <Location /cgi-bin > ScriptAlias /web/cgi-bin/ </Location> <LocationMatch /cgi-bin/errors/(?<NUMBER>[0-9]+)> ScriptAlias /web/cgi-bin/errors/%{env:MATCH_NUMBER}.cgi </LocationMatch> Big win: three fewer reasons to use mod_rewrite (and maybe mod_vhost_alias). Regards, Graham —
httpd-mod_alias-expr.patch
Description: Binary data
httpd-mod_alias-expr-test.patch
Description: Binary data