werc-1.5.0-tweaks

Tweaks for the werc website builder created by the mad architect Uriel
Log | Files | Refs | README

redirect (524B)


      1 #!/bin/rc
      2 if(~ $#2 0){
      3 	error 500
      4 	exit
      5 }
      6 switch($1){
      7 case perm*
      8 	do_log 301
      9 	echo 'HTTP/1.1 301 Moved Permanently'^$cr
     10 case temp*
     11 	do_log 302
     12 	echo 'HTTP/1.1 302 Moved Temporarily'^$cr
     13 case seeother
     14 	do_log 303
     15 	echo 'HTTP/1.1 303 See Other'^$cr
     16 case *
     17 	error 500
     18 	exit
     19 }
     20 echo 'Location: ' ^ $2 ^ $cr
     21 emit_extra_headers
     22 echo 'Content-type: text/html'^$cr
     23 echo $cr
     24 echo '<html><body>'
     25 if(~ $#3 0)
     26 	echo 'Browser did not accept redirect.'
     27 if not
     28 	echo $3
     29 echo '<a href="'^$"location^'/">Click here</a>'
     30 echo '</body></html>'