enable custom redirect codes also for nginx

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-10-13 09:51:57 +02:00
parent 58c14376d6
commit fc2ae594cb
4 changed files with 10 additions and 3 deletions

View File

@@ -862,6 +862,8 @@ class apache extends HttpConfigBase
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
$corrected_docroot = $this->idnaConvert->encode_uri($domain['documentroot']);
// prevent empty return-cde
$code = "301";
// Get domain's redirect code
$code = getDomainRedirectCode($domain['id']);
$modrew_red = '';

View File

@@ -460,8 +460,13 @@ class nginx extends HttpConfigBase
if (substr($uri, - 1) == '/') {
$uri = substr($uri, 0, - 1);
}
// prevent empty return-cde
$code = "301";
// Get domain's redirect code
$code = getDomainRedirectCode($domain['id']);
$vhost_content .= "\t" . 'if ($request_uri !~ "^/\.well-known/acme-challenge/\w+$") {' . "\n";
$vhost_content .= "\t\t" . 'return 301 ' . $uri . '$request_uri;' . "\n";
$vhost_content .= "\t\t" . 'return ' . $code .' ' . $uri . '$request_uri;' . "\n";
$vhost_content .= "\t" . '}' . "\n";
} else {
mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true);