[azipa] Apache and mod_rewrite

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Bob Williams
Date:  
Subject: [azipa] Apache and mod_rewrite
At 15:08 -0700 on 7/10/03, Joel W. Leibow indited:
>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.


I may just be misunderstanding you, but instead of just using [a-z]+
as your state pattern, could you make it more specific in a way that
it won't match your other strings? For instance, if your directory
names are all over two characters, just change your state pattern to
match exactly two characters and no more.

If you have a small number of directory names that are two characters
long, that is where RewriteCond would come in handy. For example, if
'OH' is a valid directory name, but otherwise the directory names are
longer, you might have something like this for your non-state rule:

RewriteCond        $1                                !OH            [NC]
RewriteRule        ^([a-z][a-z])[^a-z]        foo            [NC]


This rule matches two alpha characters followed by a non-alpha
character, then rewrites to foo only if the first two characters
aren't 'OH' or 'oh'; otherwise, processing skips to the next rule. If
you have other states that could be matched, add additional
RewriteCond lines.

HTH.


Regards,
Bob
-- 
Robert E. Williams, Jr.     | Visit our web site to learn about our web
President, TriVectus, LC    | design and graphic arts services, and to
<http://www.trivectus.com/> | download high-quality freeware and share-
<mailto:bob@trivectus.com>  | ware software and desktop pictures.