Index: branches/5.1.x/core/units/helpers/mod_rewrite_helper.php =================================================================== diff -u -r13168 -r13454 --- branches/5.1.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 13168) +++ branches/5.1.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 13454) @@ -1,6 +1,6 @@ HTTPQuery->Get('_mod_rw_url_'); - if (substr($url, -5) == '.html') { - $url = substr($url, 0, strlen($url) - 5); + + if ($url) { + foreach ($this->_urlEndings as $url_ending) { + if (substr($url, strlen($url) - strlen($url_ending)) == $url_ending) { + $url = substr($url, 0, strlen($url) - strlen($url_ending)); + $default_ending = $this->Application->ConfigValue('ModRewriteUrlEnding'); + + // user manually typed url with different url ending -> redirect to same url with default url ending + if (($url_ending != $default_ending) && $this->Application->ConfigValue('ForceModRewriteUrlEnding')) { + $target_url = $this->Application->BaseURL() . $url . $default_ending; + $this->Application->Redirect('external:' . $target_url, Array ('response_code' => 301)); + } + + break; + } + } } $restored = false; @@ -1020,6 +1041,8 @@ $this->Application->RewriteListeners[$prefix] = Array (&$listener, $listener_method); } + define('MOD_REWRITE_URL_ENDING', $this->Application->ConfigValue('ModRewriteUrlEnding')); + $init_done = true; }