enable custom redirect codes also for lighttpd
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -260,11 +260,7 @@ return array(
|
|||||||
'varname' => 'enabled',
|
'varname' => 'enabled',
|
||||||
'type' => 'bool',
|
'type' => 'bool',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
'save_method' => 'storeSettingField',
|
'save_method' => 'storeSettingField'
|
||||||
'websrv_avail' => array(
|
|
||||||
'apache2',
|
|
||||||
'lighttpd'
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
'customredirect_default' => array(
|
'customredirect_default' => array(
|
||||||
'label' => $lng['serversettings']['customredirect_default'],
|
'label' => $lng['serversettings']['customredirect_default'],
|
||||||
@@ -274,11 +270,7 @@ return array(
|
|||||||
'default' => '1',
|
'default' => '1',
|
||||||
'option_mode' => 'one',
|
'option_mode' => 'one',
|
||||||
'option_options_method' => 'getRedirectCodes',
|
'option_options_method' => 'getRedirectCodes',
|
||||||
'save_method' => 'storeSettingField',
|
'save_method' => 'storeSettingField'
|
||||||
'websrv_avail' => array(
|
|
||||||
'apache2',
|
|
||||||
'lighttpd'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ return array(
|
|||||||
'type' => 'text'
|
'type' => 'text'
|
||||||
),
|
),
|
||||||
'redirectcode' => array(
|
'redirectcode' => array(
|
||||||
'visible' => ((Settings::Get('system.webserver') != 'lighttpd' && Settings::Get('customredirect.enabled') == '1') ? true : false),
|
'visible' => (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') != 'lighttpd' && Settings::Get('customredirect.enabled') == '1') ? true : false),
|
'visible' => (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',
|
||||||
|
|||||||
@@ -429,8 +429,15 @@ class lighttpd extends HttpConfigBase
|
|||||||
$domain['documentroot'] = trim($domain['documentroot']);
|
$domain['documentroot'] = trim($domain['documentroot']);
|
||||||
|
|
||||||
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
|
if (preg_match('/^https?\:\/\//', $domain['documentroot'])) {
|
||||||
|
$uri = $this->idnaConvert->encode_uri($domain['documentroot']);
|
||||||
|
// prevent empty return-cde
|
||||||
|
$code = "301";
|
||||||
|
// Get domain's redirect code
|
||||||
|
$code = getDomainRedirectCode($domain['id']);
|
||||||
|
|
||||||
|
$vhost_content .= ' url.redirect-code = ' . $code. "\n";
|
||||||
$vhost_content .= ' url.redirect = (' . "\n";
|
$vhost_content .= ' url.redirect = (' . "\n";
|
||||||
$vhost_content .= ' "^/(.*)$" => "' . $this->idnaConvert->encode_uri($domain['documentroot']) . '$1"' . "\n";
|
$vhost_content .= ' "^/(.*)$" => "' . $uri . '$1"' . "\n";
|
||||||
$vhost_content .= ' )' . "\n";
|
$vhost_content .= ' )' . "\n";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user