From 518f2f9685d84d8fd90ee69518a076f0434d33f8 Mon Sep 17 00:00:00 2001 From: Uriel Date: Sun, 4 Jan 2009 23:21:55 +0100 Subject: [PATCH] Simplify and optimize some of the canonical-url-redirections. --- bin/werc.rc | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/bin/werc.rc b/bin/werc.rc index e8f4d48..00dd0ff 100755 --- a/bin/werc.rc +++ b/bin/werc.rc @@ -192,12 +192,16 @@ if(~ $REQUEST_METHOD POST) { login_user } -if(! ~ $args '') { - if(~ $args($#args) 'index') - perm_redirect `{echo $req_path | sed 's,/index$,/,'} - - pageTitle=`{echo $args | sed -e 's/ / - /g' -e 's/_/ /g'} -} +if(! ~ $#args 0) + pageTitle=`{ echo $args|sed -e 's/ / - /g' -e 's/_/ /g' } + +if(~ $req_path '/index') + perm_redirect `{echo $req_path | sed 's,/index$,/,'} + +if(~ $local_path */) + local_path=$local_path^'index' +if not if(test -d $local_path) + perm_redirect $req_path^'/' p=() cd $sitedir @@ -231,13 +235,6 @@ if(~ $pageTitle '') if not pageTitle=$"pageTitle^' | '^$"siteTitle^' '^$"siteSubTitle - -if(test -d $local_path) { - if(! ~ $local_path */) - perm_redirect $req_path^'/' - local_path=$local_path^'index' -} - select_handler if(! ~ $#debug 0)