shithub: werc

Download patch

ref: 8dc44eaa5e062a8f763ec54b1be049631ba74894
parent: 77c5d7bdbd75f1035f89f672293e827cd332a2b2
author: uriel <uriel@suckless.org>
date: Sat Jul 5 21:23:41 EDT 2008

New regex based redirection mechanism, still somewhat expermental

--- a/bin/controller.rc
+++ b/bin/controller.rc
@@ -169,11 +169,21 @@
         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^'
 
 '
 }