commit 71bcbc7dc4fa0f917bc7e91d9f1f13521feaedd9 parent e9db49560751e5e9487ddcdfcd88ecabfe1f08f6 author: nathanael <nathanael@dalliard.ch> date: Fri, 17 Oct 2025 15:15:40 +0000 s1: update redirect.sh diffstat:
| M | s1/sysfiles/redirect.sh | | | 13 | ++++++------- |
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/s1/sysfiles/redirect.sh b/s1/sysfiles/redirect.sh @@ -1,20 +1,19 @@ #!/bin/sh - -REDIRECT_PATH="${PATH_INFO#/}" -REDIRECT_URL=$(while IFS=: read -r key value; do - if [ "$key" = "$REDIRECT_PATH" ]; then +path="${PATH_INFO#/}" +url=$(while IFS=: read -r key value; do + if [ "$key" = "$path" ]; then echo "$value" break fi done < /go/redirects.txt) -if [ -n "$REDIRECT_URL" ]; then +if [ -n "$url" ]; then printf "Status: 301 Moved Permanently\r\n" - printf "Location: %s\r\n" "$REDIRECT_URL" + printf "Location: %s\r\n" "$url" printf "\r\n" else printf "Status: 404 Not Found\r\n" printf "Content-Type: text/plain\r\n" printf "\r\n" - printf "Redirect not found\n" + printf "redirect not found\n" fi