swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit 5d9386b9294c8551e4c1994ed85c0c0d7773b6f0
parent 4cc4015b5d43ccc2298f7f877b6d13191ab106d3
Author: uriel@suckless.org <unknown>
Date:   Sun,  6 Jul 2008 01:23:41 +0200

New regex based redirection mechanism, still somewhat expermental
Diffstat:
Mbin/controller.rc | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/bin/controller.rc b/bin/controller.rc @@ -169,14 +169,24 @@ for (i in ('' $args)) { inBlog = 'yes' } - +echo $body $redirectPermanent>> /tmp/foo # Redirections and other preprocessing if (~ $#redirectPermanent 1) { - echo 'Status: 301 Moved Permanantly + echo 'Status: 301 Moved Permanantly Location: '^$"redirectPermanent^' ' } +if not if (~ $#redirectPermanent 2) { + # Experimental regexp sub-based redirect, probably should find a nicer interface + # For now only used at sites/harmful.cat-v.org/software/OO_programming/_config + to=`{echo $REQUEST_URI|sed 's|'^$redirectPermanent(1)^'|'^$redirectPermanent(2)^'|'} + if(! ~ $to $REQUEST_URI) + echo 'Status: 301 Moved Permanantly +Location: '^$to^' + +' +} # Template/body selection