From 0d65cd3c5cc0c3b8d1c06be1bfb1b0b2d3672141 Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Tue, 1 Dec 2015 16:40:34 +0100 Subject: [PATCH] Add redirect_to_code in vhost --- README.md | 3 ++- templates/etc/nginx/sites-available/_redirect.j2 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 67d011a..a55cde3 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ You can see many examples in: [tests/test.yml](tests/test.yml). - `enable`: (O) Enable the vhost (default is true) - `delete`: (O) Delete the vhost (default is false) - `redirect_from`: (O) Domain list to redirect to the first `name`. You can use this key to redirect non-www to www - - `redirect_to`: (O) Redirect (302) all requests to this domain. Please set scheme (http:// or https:// or $sheme). + - `redirect_to`: (O) Redirect all requests to this domain. Please set scheme (http:// or https:// or $sheme). + - `redirect_to_code`: Redirect code (default: 302) - `location`: (O) Add new custom locations (it does not overwrite!) - `more`: (O) Add more custom infos. - `upstream_params`: (O) Add upstream params (useful when you want to pass variables to PHP) diff --git a/templates/etc/nginx/sites-available/_redirect.j2 b/templates/etc/nginx/sites-available/_redirect.j2 index bc6ad5c..4098a50 100644 --- a/templates/etc/nginx/sites-available/_redirect.j2 +++ b/templates/etc/nginx/sites-available/_redirect.j2 @@ -7,7 +7,7 @@ {% endblock %} {% block template_try_files %} - return 302 {{ item.redirect_to }}$request_uri; + return {{ item.redirect_to_code | default('302') }} {{ item.redirect_to }}$request_uri; {% endblock %} {% block template_local_content %}