redirect - custom status code

This commit is contained in:
florian 2023-08-04 12:26:37 +02:00
parent ee5397df55
commit 38ab5ea21a
No known key found for this signature in database
GPG key ID: 3D80806F12602A7C
2 changed files with 12 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{% if REDIRECT_TO != "" +%}
{% if REDIRECT_TO_REQUEST_URI == "yes" +%}
return 301 {{ REDIRECT_TO }}$request_uri;
return {{ REDIRECT_TO_STATUS_CODE }} {{ REDIRECT_TO }}$request_uri;
{% else +%}
return 301 {{ REDIRECT_TO }};
return {{ REDIRECT_TO_STATUS_CODE }} {{ REDIRECT_TO }};
{% endif %}
{% endif %}

View file

@ -22,6 +22,16 @@
"label": "Append request URI",
"regex": "^(yes|no)$",
"type": "check"
},
"REDIRECT_TO_STATUS_CODE": {
"context": "multisite",
"default": "301",
"help": "Status code to send to client when redirecting.",
"id": "redirect-to-status-code",
"label": "Append request URI",
"regex": "^(301|302)$",
"type": "select",
"select": ["301", "302"]
}
}
}