Author: Joel W. Leibow Date: Subject: Apache and mod_rewrite
Alright, I have developed a site that is making extensive use of the rewrite
module in apache. For example, I have a RewriteMap created that has each
state listed in it with a corresponding ID relative to the primary key in a
table in the database. This allows me to search the url for any occurrence
of /[a-z]+/ and look it up in the RewriteMap. If it matches, the
corresponding ID is returned and I can query the database with that ID
The problem that I am having is that I also have about 18,000
sub-directories that I would like to fake. Each directory could also match
the pattern /[a-z]+/. I don't want to look up the pattern in the RewriteMap
unless it is definitely a state name. Instead I would like to pass the
"/sub-directory" that has been requested via the query string for pulling
info from a database. How do I go about distinguishing each state from each
possible sub-directory without having to write a regular expression to match
each state name? I was thinking that RewriteCond could help but am
uncertain how exactly to use that portion of the rewrite module. Advice?
I realize this is pretty complex, but hopefully my description makes sense.
Any advice or input would be greatly appreciated.