diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php index 2068391004228aa3d62efa87933a66f9494f390c..362a154c3211c7f5ba7af8918e8c82dff15e8eb2 100644 --- a/interface/web/sites/form/web_domain.tform.php +++ b/interface/web/sites/form/web_domain.tform.php @@ -236,7 +236,7 @@ $form["tabs"]['redirect'] = array ( 'redirect_path' => array ( 'datatype' => 'VARCHAR', 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '@^(([.]{0})|(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~]*(\?\S+)?)?)?)|(/[\w/_\.\-]{1,255}/))$@', + 'regex' => '@^(([.]{0})|(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~]*(\?\S+)?)?)?)|(/[\w/_\.\-]{1,255}/))$@', 'errmsg'=> 'redirect_error_regex'), ), 'formtype' => 'TEXT', diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 12f8cc5512ce36d9b14742a0a48a4d4cb9d510c5..163cd7e5f1245cd4e3fe8ffcefc90e3b9fe40d17 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -693,8 +693,13 @@ class apache2_plugin { $rewrite_rules = array(); if($data['new']['redirect_type'] != '') { if(substr($data['new']['redirect_path'],-1) != '/') $data['new']['redirect_path'] .= '/'; - $rewrite_target = $data['new']['redirect_path']; - $rewrite_target_ssl = $data['new']['redirect_path']; + if(substr($data['new']['redirect_path'],0,8) == '[scheme]'){ + $rewrite_target = 'http'.substr($data['new']['redirect_path'],8); + $rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'],8); + } else { + $rewrite_target = $data['new']['redirect_path']; + $rewrite_target_ssl = $data['new']['redirect_path']; + } /* Disabled path extension if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') { $data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/'; diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 24b83b27c72620afe071b9b80af5a9d274c2cca1..3d536eaa8701772df56cd24bcb790714150540bf 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -680,6 +680,7 @@ class nginx_plugin { $rewrite_rules = array(); if($data['new']['redirect_type'] != '') { if(substr($data['new']['redirect_path'],-1) != '/') $data['new']['redirect_path'] .= '/'; + if(substr($data['new']['redirect_path'],0,8) == '[scheme]') $data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'],8); /* Disabled path extension if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') { $data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/';