enable custom redirect codes also for nginx
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -54,7 +54,7 @@ return array(
|
|||||||
'type' => 'text'
|
'type' => 'text'
|
||||||
),
|
),
|
||||||
'redirectcode' => array(
|
'redirectcode' => array(
|
||||||
'visible' => ((Settings::Get('system.webserver') == 'apache2' && Settings::Get('customredirect.enabled') == '1') ? true : false),
|
'visible' => ((Settings::Get('system.webserver') != 'lighttpd' && Settings::Get('customredirect.enabled') == '1') ? true : false),
|
||||||
'label' => $lng['domains']['redirectifpathisurl'],
|
'label' => $lng['domains']['redirectifpathisurl'],
|
||||||
'desc' => $lng['domains']['redirectifpathisurlinfo'],
|
'desc' => $lng['domains']['redirectifpathisurlinfo'],
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ return array(
|
|||||||
'value' => $urlvalue
|
'value' => $urlvalue
|
||||||
),
|
),
|
||||||
'redirectcode' => array(
|
'redirectcode' => array(
|
||||||
'visible' => ((Settings::Get('system.webserver') == 'apache2' && Settings::Get('customredirect.enabled') == '1') ? true : false),
|
'visible' => ((Settings::Get('system.webserver') != 'lighttpd' && Settings::Get('customredirect.enabled') == '1') ? true : false),
|
||||||
'label' => $lng['domains']['redirectifpathisurl'],
|
'label' => $lng['domains']['redirectifpathisurl'],
|
||||||
'desc' => $lng['domains']['redirectifpathisurlinfo'],
|
'desc' => $lng['domains']['redirectifpathisurlinfo'],
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
|
|||||||
@@ -862,6 +862,8 @@ class apache extends HttpConfigBase
|
|||||||
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
|
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
|
||||||
$corrected_docroot = $this->idnaConvert->encode_uri($domain['documentroot']);
|
$corrected_docroot = $this->idnaConvert->encode_uri($domain['documentroot']);
|
||||||
|
|
||||||
|
// prevent empty return-cde
|
||||||
|
$code = "301";
|
||||||
// Get domain's redirect code
|
// Get domain's redirect code
|
||||||
$code = getDomainRedirectCode($domain['id']);
|
$code = getDomainRedirectCode($domain['id']);
|
||||||
$modrew_red = '';
|
$modrew_red = '';
|
||||||
|
|||||||
@@ -460,8 +460,13 @@ class nginx extends HttpConfigBase
|
|||||||
if (substr($uri, - 1) == '/') {
|
if (substr($uri, - 1) == '/') {
|
||||||
$uri = substr($uri, 0, - 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" . '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";
|
$vhost_content .= "\t" . '}' . "\n";
|
||||||
} else {
|
} else {
|
||||||
mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true);
|
mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true);
|
||||||
|
|||||||
Reference in New Issue
Block a user