I'm using Apache 2.2.4 on a Win2k3 server. I have a number of urls in the format: domain.com/topic/ that I need to rewrite. Exactly 25 of those urls need to be handled by one script. Hundreds of urls need to be handled by a separate script.
Regex alone isn't sufficient to pick out the 25 from the rest, since they follow the same pattern. There are a number of ways to handle this, including the following:
1) Use a txt RewriteMap with the 25 url keys. One thing that feels icky about this is that all 25 would return the same value, no matter which key was looked for.
2) Chain 25 RewriteCond directives together. If one of them hits, then the following RewriteRule will rewrite to the proper script, otherwise the next RewriteRule can use the other script. Of course, this will clutter up the conf file.
One drawback for the RewriteMap method, is that I can't find a Windows tool to generate a dbm file from the text map. I tried to use the perl script from the Apache docs, but it left me with two files (map.db.pag and map.db.dir), and no instructions on what to do with those two files...
Anyway, both of these methods will work (and yes, I know I could always handle it in-script), but of these two ways, which is better? Which is more efficient/faster, etc?
The RewriteMap method will also allow me to use the default value to handle the alternate script, so I'm leaning towards RewriteMap unless there is a major reason that chained RewriteCond's are better. The only thing that is really making me hesitate is having to use a text map... if you know of a Windows method for converting to a dbm, that'd be great :)
[edited by: Bluesplinter at 11:34 pm (utc) on Mar. 5, 2007]