Monday November 13, 2006
mod_rewrite Happiness
- Posted by Rob (#1) on November 13, 2006 15:09 CET
Once in a while you write some code or a regular expression that makes you proud. Today has been one of those days. I'll admit that what I wrote isn't really special to advanced programmers, but five-minute one-liners that do the equivalent of what an intern could do in a hundred lines after a week make me smile:
RewriteRule ^/users/([^/]+)(/|/([^/]+)(/|/([^/]+)(/)?)?)?$ /users/index.php [L,E=profileId:$1,E=sectionId:$3,E=pageId:$5]
If you understand this, cool - definitely going to beat the average MySpace URL don't you think?
If you don't understand, no worries. You will at least understand why I answer mates and family with "computer stuff" when explaining my job.
- PermaLink: mod_rewrite Happiness
- Tags: work, mod_rewrite, Apache, regexps
- Post comment