Mar 15, 2010 at 8:07 PM
Edited Mar 15, 2010 at 9:18 PM
I'm glad to help. I see you're working on a .givv site. I hope you're doing something good for the government!
ok, on your first set of rules - the ones that you said "could be better" - they look fine. You could consolidate and generalize them if you wanted to, using a RewriteMap. RewriteMap is a new feature of IIRF v2.1, that does a lookup
in a "map file". like this:
RewriteMap pathmap txt:iirf-pathmap.txt
(the above rule must be all-on-one-line)
and the contents of the iirf-pathmap.txt file would be a list of pairs, each pair maps a value from an incoming URL to a value for the url-to-redirect-to. Like this:
# map file for IIRF
But that might make sense only if you have many things to map from and to. With only 3 rules, it might not make sense.
Ok, on your next set of rules, you can consolidate them to a single rule, like this:
(once again, the above rule must be all-on-one-line)
As you can see there are 3 capturing groups. The first captures either a 3 or a 4. The next captures the preceding query path segment. This is the thing that is A-SomeCategory... through ... Z-SomeCategory. Actually, that rule will match for any query path
segment, not only segments that begin with A- ... through Z-. If you want to handle only A-Z, then you can write a more restrictive rule, like this:
This one will match only URLs that have the penultimate query path segment starting with A-, B-, ... through Z-.