Make perm redirect code a bit simpler and a bit less hideous.
This commit is contained in:
parent
d4cea460b5
commit
1c388b2a48
1 changed files with 6 additions and 6 deletions
12
bin/werc.rc
12
bin/werc.rc
|
|
@ -219,13 +219,13 @@ for(i in ('' $args)) {
|
||||||
cd $werc_root
|
cd $werc_root
|
||||||
|
|
||||||
# Redirections and other preprocessing
|
# Redirections and other preprocessing
|
||||||
if(~ $#redirectPermanent 1)
|
if(~ $#redirectPermanent 1) {
|
||||||
perm_redirect $"redirectPermanent
|
perm_redirect $"redirectPermanent
|
||||||
|
}
|
||||||
if not if(~ $#redirectPermanent 2 && {echo $SERVER_NAME^$req_path|grep -s $redirectPermanent(1) }) {
|
if not if(~ $#redirectPermanent 2) {
|
||||||
# Experimental regexp sub-based redirect, probably should find a nicer interface
|
from='http://'^$SERVER_NAME^$req_path
|
||||||
to=`{echo $SERVER_NAME^$req_path|sed 's@'^$redirectPermanent(1)^'@'^$redirectPermanent(2)^'@'}
|
to=`{echo $from|sed 's@'^$redirectPermanent(1)^'@'^$redirectPermanent(2)^'@'}
|
||||||
if(! ~ $to $req_path)
|
if(! ~ $to $from)
|
||||||
perm_redirect $to
|
perm_redirect $to
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue