httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <cove...@gmail.com>
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
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message