From 8309d8765bc5285405892d5fa35504d747c5c21c Mon Sep 17 00:00:00 2001 From: ftimme <ft@falkotimme.com> Date: Tue, 30 Oct 2012 11:21:04 -0400 Subject: [PATCH] - nginx alias/subdomain redirects: Added parenthese around non-capturing parentheses so that $2 captures the correct content. --- server/plugins-available/nginx_plugin.inc.php | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index a0e8314..dd26e94 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -951,7 +951,7 @@ switch($data['new']['subdomain']) { case 'www': if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path - $rewrite_exclude = '(?!'.substr($data['new']['redirect_path'],0,-1).')'; + $rewrite_exclude = '((?!'.substr($data['new']['redirect_path'],0,-1).'))'; } else { // URL - check if URL is local $tmp_redirect_path = $data['new']['redirect_path']; if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7); @@ -959,7 +959,7 @@ if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1); if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - $rewrite_exclude = '(?!'.$tmp_redirect_path_parts['path'].')'; + $rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; } else { $rewrite_exclude = '(.?)'; } @@ -972,7 +972,7 @@ 'rewrite_exclude' => $rewrite_exclude); if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path - $rewrite_exclude = '(?!'.substr($data['new']['redirect_path'],0,-1).')'; + $rewrite_exclude = '((?!'.substr($data['new']['redirect_path'],0,-1).'))'; } else { // URL - check if URL is local $tmp_redirect_path = $data['new']['redirect_path']; if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7); @@ -980,7 +980,7 @@ if($tmp_redirect_path_parts['host'] == 'www.'.$data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1); if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - $rewrite_exclude = '(?!'.$tmp_redirect_path_parts['path'].')'; + $rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; } else { $rewrite_exclude = '(.?)'; } @@ -994,7 +994,7 @@ break; case '*': if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path - $rewrite_exclude = '(?!'.substr($data['new']['redirect_path'],0,-1).')'; + $rewrite_exclude = '((?!'.substr($data['new']['redirect_path'],0,-1).'))'; } else { // URL - check if URL is local $tmp_redirect_path = $data['new']['redirect_path']; if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7); @@ -1002,7 +1002,7 @@ if(substr($tmp_redirect_path_parts['host'],-strlen($data['new']['domain'])) == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1); if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - $rewrite_exclude = '(?!'.$tmp_redirect_path_parts['path'].')'; + $rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; } else { $rewrite_exclude = '(.?)'; } @@ -1016,7 +1016,7 @@ break; default: if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path - $rewrite_exclude = '(?!'.substr($data['new']['redirect_path'],0,-1).')'; + $rewrite_exclude = '((?!'.substr($data['new']['redirect_path'],0,-1).'))'; } else { // URL - check if URL is local $tmp_redirect_path = $data['new']['redirect_path']; if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7); @@ -1024,7 +1024,7 @@ if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1); if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - $rewrite_exclude = '(?!'.$tmp_redirect_path_parts['path'].')'; + $rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; } else { $rewrite_exclude = '(.?)'; } @@ -1092,7 +1092,7 @@ switch($alias['subdomain']) { case 'www': if(substr($alias['redirect_path'],0,1) == '/'){ // relative path - $rewrite_exclude = '(?!'.substr($alias['redirect_path'],0,-1).')'; + $rewrite_exclude = '((?!'.substr($alias['redirect_path'],0,-1).'))'; } else { // URL - check if URL is local $tmp_redirect_path = $alias['redirect_path']; if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7); @@ -1100,7 +1100,7 @@ if($tmp_redirect_path_parts['host'] == $alias['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1); if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - $rewrite_exclude = '(?!'.$tmp_redirect_path_parts['path'].')'; + $rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; } else { $rewrite_exclude = '(.?)'; } @@ -1113,7 +1113,7 @@ 'rewrite_exclude' => $rewrite_exclude); if(substr($alias['redirect_path'],0,1) == '/'){ // relative path - $rewrite_exclude = '(?!'.substr($alias['redirect_path'],0,-1).')'; + $rewrite_exclude = '((?!'.substr($alias['redirect_path'],0,-1).'))'; } else { // URL - check if URL is local $tmp_redirect_path = $alias['redirect_path']; if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7); @@ -1121,7 +1121,7 @@ if($tmp_redirect_path_parts['host'] == 'www.'.$alias['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1); if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - $rewrite_exclude = '(?!'.$tmp_redirect_path_parts['path'].')'; + $rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; } else { $rewrite_exclude = '(.?)'; } @@ -1135,7 +1135,7 @@ break; case '*': if(substr($alias['redirect_path'],0,1) == '/'){ // relative path - $rewrite_exclude = '(?!'.substr($alias['redirect_path'],0,-1).')'; + $rewrite_exclude = '((?!'.substr($alias['redirect_path'],0,-1).'))'; } else { // URL - check if URL is local $tmp_redirect_path = $alias['redirect_path']; if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7); @@ -1143,7 +1143,7 @@ if(substr($tmp_redirect_path_parts['host'],-strlen($alias['domain'])) == $alias['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1); if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - $rewrite_exclude = '(?!'.$tmp_redirect_path_parts['path'].')'; + $rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; } else { $rewrite_exclude = '(.?)'; } @@ -1157,7 +1157,7 @@ break; default: if(substr($alias['redirect_path'],0,1) == '/'){ // relative path - $rewrite_exclude = '(?!'.substr($alias['redirect_path'],0,-1).')'; + $rewrite_exclude = '((?!'.substr($alias['redirect_path'],0,-1).'))'; } else { // URL - check if URL is local $tmp_redirect_path = $alias['redirect_path']; if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7); @@ -1165,7 +1165,7 @@ if($tmp_redirect_path_parts['host'] == $alias['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){ if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1); if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path']; - $rewrite_exclude = '(?!'.$tmp_redirect_path_parts['path'].')'; + $rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))'; } else { $rewrite_exclude = '(.?)'; } -- Gitblit v1.9.1