Index: install/english.lang =================================================================== --- install/english.lang (revision 13400) +++ install/english.lang (working copy) @@ -219,6 +219,7 @@ RmlsZW5hbWUgU3BlY2lhbCBDaGFyIFJlcGxhY2VtZW50 Rmlyc3QgRGF5IE9mIFdlZWs= QWx3YXlzIHVzZSBJbWFnZU1hZ2ljayB0byByZXNpemUgaW1hZ2Vz + Rm9yY2UgUmVkaXJlY3QgdG8gU2VsZWN0ZWQgVVJMIEVuZGluZw== UmVkaXJlY3QgdG8gSFRUUCB3aGVuIFNTTCBpcyBub3QgcmVxdWlyZWQ= RnVsbCBpbWFnZSBIZWlnaHQ= RnVsbCBpbWFnZSBXaWR0aA== @@ -230,6 +231,7 @@ TWFpbGluZyBMaXN0IFF1ZXVlIFBlciBTdGVw TWFpbGluZyBMaXN0IFNlbmQgUGVyIFN0ZXA= TWF4aW11bSBudW1iZXIgb2YgaW1hZ2Vz + RGVmYXVsdCBVUkwgRW5kaW5nIGluIFNFTy1mcmllbmRseSBtb2Rl VGVtcGxhdGUgZm9yICJJbnN1ZmZpY2llbnQgUGVybWlzc2lvbnMiIEVycm9y R1pJUCBjb21wcmVzc2lvbiBsZXZlbCAwLTk= UGF0aCB0byBXZWJzaXRl @@ -262,7 +264,7 @@ VXNlIFRvb2xiYXIgTGFiZWxz VXNlIFZpc2l0b3IgVHJhY2tpbmc= VXNlIEphdmFTY3JpcHQgcmVkaXJlY3Rpb24gYWZ0ZXIgbG9naW4vbG9nb3V0IChmb3IgSUlTKQ== - VXNlIE1PRCBSRVdSSVRF + RW5hYmxlIFNFTy1mcmllbmRseSBVUkxzIG1vZGUgKE1PRC1SRVdSSVRFKQ== RW5hYmxlIE1PRF9SRVdSSVRFIGZvciBTU0w= V2Vic2l0ZSBuYW1l WWFob28gQXBwbGljYXRpb25JZA== @@ -859,6 +861,7 @@ SGlkZQ== QWxsIEZpbGVz Q1NWIEZpbGVz + VXNlciB3aWxsIGJlIGF1dG9tYXRpY2FsbHkgcmVkaXJlY3RlZCB0byB0aGUgc2VsZWN0ZWQgVXJsIEVuZGluZyBpbiBjYXNlIHdoZW4gY3VycmVudCBwYWdlIHVybCBoYXMgYSBkaWZmZXJlbnQgZW5kaW5n SW1hZ2UgRmlsZXM= UE9QMyBTZXJ2ZXIgUG9ydC4gRm9yIGV4LiAiMTEwIiBmb3IgcmVndWxhciBjb25uZWN0aW9uLCAiOTk1IiBmb3Igc2VjdXJlIGNvbm5lY3Rpb24u UE9QMyBTZXJ2ZXIgQWRkcmVzcy4gRm9yIGV4LiB1c2UgInNzbDovL3BvcC5nbWFpbC5jb20iIGZvciBHbWFpbCwgInBvcC5tYWlsLnlhaG9vLmNvbSIgZm9yIFlhaG9vLg== Index: install/install_data.sql =================================================================== --- install/install_data.sql (revision 13444) +++ install/install_data.sql (working copy) @@ -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: install/upgrades.sql =================================================================== --- install/upgrades.sql (revision 13444) +++ install/upgrades.sql (working copy) @@ -1799,3 +1799,10 @@ ALTER TABLE ConfigurationValues ADD HintLabel VARCHAR(255) NULL DEFAULT NULL, ADD INDEX (HintLabel); + +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'); + +UPDATE Phrase +SET l<%PRIMARY_LANGUAGE%>_Translation = 'Enable SEO-friendly URLs mode (MOD-REWRITE)' +WHERE Phrase = 'la_config_use_modrewrite' AND l<%PRIMARY_LANGUAGE%>_Translation = 'Use MOD REWRITE'; \ No newline at end of file Index: kernel/application.php =================================================================== --- kernel/application.php (revision 13400) +++ kernel/application.php (working copy) @@ -1833,13 +1833,12 @@ // remove tempporary parameters used by listeners unset($params['t'], $params['inject_parts'], $params['pass_template'], $params['pass_category'], $params['category_processed']); - if ($catalog_item_found || !$cat_processed || !defined('EXP_DIR_URLS')) { - // this catalog item detail page OR there is no category given - $ret = trim($ret, '/') . '.html'; + if (array_key_exists('url_ending', $params)) { + $ret = trim($ret, '/') . $params['url_ending']; + unset($params['url_ending']); } else { - // url ends with "/" and not with ".html" - $ret = trim($ret, '/') . '/'; + $ret = trim($ret, '/') . MOD_REWRITE_URL_ENDING; } if ($env) { Index: kernel/utility/http_query.php =================================================================== --- kernel/utility/http_query.php (revision 13400) +++ kernel/utility/http_query.php (working copy) @@ -240,7 +240,7 @@ // if ($this->Application->RewriteURLs()) { if ($this->Application->RewriteURLs() || $this->Get('_mod_rw_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: kernel/utility/unit_config_reader.php =================================================================== --- kernel/utility/unit_config_reader.php (revision 13437) +++ kernel/utility/unit_config_reader.php (working copy) @@ -85,7 +85,6 @@ 'SessionBrowserSignatureCheck', 'SessionIPAddressCheck', 'CookieSessions', - 'SessionTimeout', 'KeepSessionOnBrowserClose', 'User_GuestGroup', 'User_LoggedInGroup', @@ -101,6 +100,8 @@ // tracking related 'UseChangeLog', 'UseVisitorTracking', + 'ModRewriteUrlEnding', + 'ForceModRewriteUrlEnding', 'UseCronForRegularEvent', ); Index: units/helpers/mod_rewrite_helper.php =================================================================== --- units/helpers/mod_rewrite_helper.php (revision 13400) +++ units/helpers/mod_rewrite_helper.php (working copy) @@ -45,6 +45,13 @@ var $_templateAliases = null; /** + * Possible url endings from ModRewriteUrlEnding configuration variable + * + * @var Array + */ + var $_urlEndings = Array ('.html', '/', ''); + + /** * Constructor of kModRewriteHelper class * * @return kModRewriteHelper @@ -60,8 +67,22 @@ { $passed = Array (); $url = $this->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; }