httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <>
Subject Re: [users@httpd] RewriteMap & hashes: dealing with a hash miss
Date Fri, 06 Feb 2009 16:23:58 GMT
> The answer:
>  RewriteCond %{REQUEST_URI} ^/id/(.*)
>  RewriteCond ${ids:%1} !^$
>  RewriteRule ^/id/(.*)$ ${ids:$1} [R=301]

> It's a bit filthy that the first RewriteCond and the pattern in the
> RewriteRule are duplicated, but I don't know if there's a way to improve
> that.

Maybe some room for removing some of the duplication:

You can use $1 in the RewriteCond, avoiding the first condition altogether.
You could also change the 2nd condition to be (.+) and use %1 in the
RewriteRule instead of re-consulting the map (this one is arguably not
worth the complexity because the duplication isn't as bad)

Eric Covener

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message