September 15th, 2007
More ModRewrite - Using a dbm file instead of a txt fileSeptember 15th 7:36 PM
So i'm using ModRewrite to do a 1-to-1 forwarding list of urls on a website where my cms can write to the map file automatically (so we don't have to edit httpd.conf every time we want to add or remove an entry).
The problem is that if the text file gets long enough (probably way longer than mine is, but i'm an efficiency freak, and having a hundred lookups before the user ever gets to your page is excessive).
So I decided to use a .dbm file (which is a hashed file of 1-to-1 matched phrases, Dbm on wikipedia). The problem is that the documentation for ModRewrite really sucks sometimes, and it doesn't explain fully how to get all the way through the process, which leaves you guessing sometimes.
Read More »
Posted by Jeremy Tunnell| Comments (3)
Other Tags
August 21st, 2007
Mod_rewrite: Attempting to bend RewriteMap, RewriteCond, and RewriteRule to my will...August 21st 9:29 PM
Mod_rewrite is a poorly documented, yet incredibly flexible package for Apache.
I've recently been occupied with how to set up a system of "short" urls for a website, that can be easily edited by regular users. Obviously, we can't use simple redirects or even rewriterules in httpd.conf because we don't want to give everyone write access to that file.
So it looks like the most straightforward way to do it is to use a rewritemap...basically a two-column text file (source/destination) that mod_rewrite uses to "look up" an incoming url and rewrite it to our target url.
Read More »
Posted by Jeremy Tunnell| Comments (10)
Other Tags