Skip to content

Commit 22eabc9

Browse files
committed
Add a / at the end of a rewrite path automatically in case that there is no /
1 parent 47cca9b commit 22eabc9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ function update($event_name,$data) {
506506
// Rewrite rules
507507
$rewrite_rules = array();
508508
if($data["new"]["redirect_type"] != '') {
509+
if(substr($data["new"]["redirect_path"],-1) != '/') $data["new"]["redirect_path"] .= '/';
509510
$rewrite_rules[] = array( 'rewrite_domain' => $data["new"]["domain"],
510511
'rewrite_type' => ($data["new"]["redirect_type"] == 'no')?'':'['.$data["new"]["redirect_type"].']',
511512
'rewrite_target' => $data["new"]["redirect_path"]);
@@ -552,6 +553,7 @@ function update($event_name,$data) {
552553
$app->log("Add server alias: $alias[domain]",LOGLEVEL_DEBUG);
553554
// Rewriting
554555
if($alias["redirect_type"] != '') {
556+
if(substr($data["new"]["redirect_path"],-1) != '/') $data["new"]["redirect_path"] .= '/';
555557
$rewrite_rules[] = array( 'rewrite_domain' => $alias["domain"],
556558
'rewrite_type' => ($alias["redirect_type"] == 'no')?'':'['.$alias["redirect_type"].']',
557559
'rewrite_target' => $alias["redirect_path"]);

0 commit comments

Comments
 (0)