Skip to content

Commit 45ee671

Browse files
committed
- Introduced placeholder [scheme] also for the website's "Redirect" tab.
1 parent e64fbbc commit 45ee671

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

interface/web/sites/form/web_domain.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
'redirect_path' => array (
237237
'datatype' => 'VARCHAR',
238238
'validators' => array ( 0 => array ( 'type' => 'REGEX',
239-
'regex' => '@^(([.]{0})|(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~]*(\?\S+)?)?)?)|(/[\w/_\.\-]{1,255}/))$@',
239+
'regex' => '@^(([.]{0})|(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~]*(\?\S+)?)?)?)|(/[\w/_\.\-]{1,255}/))$@',
240240
'errmsg'=> 'redirect_error_regex'),
241241
),
242242
'formtype' => 'TEXT',

server/plugins-available/apache2_plugin.inc.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,13 @@ function update($event_name,$data) {
693693
$rewrite_rules = array();
694694
if($data['new']['redirect_type'] != '') {
695695
if(substr($data['new']['redirect_path'],-1) != '/') $data['new']['redirect_path'] .= '/';
696-
$rewrite_target = $data['new']['redirect_path'];
697-
$rewrite_target_ssl = $data['new']['redirect_path'];
696+
if(substr($data['new']['redirect_path'],0,8) == '[scheme]'){
697+
$rewrite_target = 'http'.substr($data['new']['redirect_path'],8);
698+
$rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'],8);
699+
} else {
700+
$rewrite_target = $data['new']['redirect_path'];
701+
$rewrite_target_ssl = $data['new']['redirect_path'];
702+
}
698703
/* Disabled path extension
699704
if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') {
700705
$data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/';

server/plugins-available/nginx_plugin.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ function update($event_name,$data) {
680680
$rewrite_rules = array();
681681
if($data['new']['redirect_type'] != '') {
682682
if(substr($data['new']['redirect_path'],-1) != '/') $data['new']['redirect_path'] .= '/';
683+
if(substr($data['new']['redirect_path'],0,8) == '[scheme]') $data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'],8);
683684
/* Disabled path extension
684685
if($data['new']['redirect_type'] == 'no' && substr($data['new']['redirect_path'],0,4) != 'http') {
685686
$data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/';

0 commit comments

Comments
 (0)