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;
}
Index: branches/5.1.x/core/install/install_data.sql
===================================================================
diff -u -r13444 -r13454
--- branches/5.1.x/core/install/install_data.sql (.../install_data.sql) (revision 13444)
+++ branches/5.1.x/core/install/install_data.sql (.../install_data.sql) (revision 13454)
@@ -32,6 +32,8 @@
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'PageHitCounter', '0', 'In-Portal', 'in-portal:configure_advanced', '', '', '', NULL, NULL, 0, 0, 0, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Site_Path', '/', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PathToWebsite', 'text', '', '', 10.01, 0, 1, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseModRewrite', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_use_modrewrite', 'checkbox', '', '', 10.02, 0, 1, NULL);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ModRewriteUrlEnding', '.html', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ModRewriteUrlEnding', 'select', '', '=+,/=+/,.html=+.html', 10.021, 0, 0, NULL);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ForceModRewriteUrlEnding', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceModRewriteUrlEnding', 'checkbox', '', NULL, 10.022, 0, 0, 'la_hint_ForceModRewriteUrlEnding');
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'cms_DefaultDesign', '#default_design#', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultDesignTemplate', 'text', NULL, NULL, 10.03, 0, 0, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ErrorTemplate', 'error_notfound', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_error_template', 'text', '', '', 10.04, 0, 0, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'NoPermissionTemplate', 'no_permission', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_nopermission_template', 'text', '', '', 10.05, 0, 0, NULL);
Index: branches/5.1.x/core/kernel/utility/http_query.php
===================================================================
diff -u -r13446 -r13454
--- branches/5.1.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 13446)
+++ branches/5.1.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 13454)
@@ -1,6 +1,6 @@
Application->RewriteURLs() || $rewrite_url) {
if (defined('DEBUG_MODE') && $this->Application->isDebugMode()) {
- $this->Application->Debugger->profileStart('url_parsing');
+ $this->Application->Debugger->profileStart('url_parsing', 'Parsing MOD_REWRITE url');
$this->processRewriteURL();
$description = 'Parsing MOD_REWRITE url (template: ' . $this->Get('t') . ')';
$this->Application->Debugger->profileFinish('url_parsing', $description);
Index: branches/5.1.x/core/kernel/application.php
===================================================================
diff -u -r13394 -r13454
--- branches/5.1.x/core/kernel/application.php (.../application.php) (revision 13394)
+++ branches/5.1.x/core/kernel/application.php (.../application.php) (revision 13454)
@@ -1,6 +1,6 @@
_Translation = 'Enable SEO-friendly URLs mode (MOD-REWRITE)'
+WHERE Phrase = 'la_config_use_modrewrite' AND l<%PRIMARY_LANGUAGE%>_Translation = 'Use MOD REWRITE';
Index: branches/5.1.x/core/install/english.lang
===================================================================
diff -u -r13453 -r13454
--- branches/5.1.x/core/install/english.lang (.../english.lang) (revision 13453)
+++ branches/5.1.x/core/install/english.lang (.../english.lang) (revision 13454)
@@ -223,6 +223,7 @@
RmlsZW5hbWUgU3BlY2lhbCBDaGFyIFJlcGxhY2VtZW50
Rmlyc3QgRGF5IE9mIFdlZWs=
QWx3YXlzIHVzZSBJbWFnZU1hZ2ljayB0byByZXNpemUgaW1hZ2Vz
+ Rm9yY2UgUmVkaXJlY3QgdG8gU2VsZWN0ZWQgVVJMIEVuZGluZw==
UmVkaXJlY3QgdG8gSFRUUCB3aGVuIFNTTCBpcyBub3QgcmVxdWlyZWQ=
RnVsbCBpbWFnZSBIZWlnaHQ=
RnVsbCBpbWFnZSBXaWR0aA==
@@ -234,6 +235,7 @@
TWFpbGluZyBMaXN0IFF1ZXVlIFBlciBTdGVw
TWFpbGluZyBMaXN0IFNlbmQgUGVyIFN0ZXA=
TWF4aW11bSBudW1iZXIgb2YgaW1hZ2Vz
+ RGVmYXVsdCBVUkwgRW5kaW5nIGluIFNFTy1mcmllbmRseSBtb2Rl
VGVtcGxhdGUgZm9yICJJbnN1ZmZpY2llbnQgUGVybWlzc2lvbnMiIEVycm9y
R1pJUCBjb21wcmVzc2lvbiBsZXZlbCAwLTk=
UGF0aCB0byBXZWJzaXRl
@@ -266,7 +268,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