Accented characters in URL and 404 error
Posted: Sun May 29, 2016 10:29 am
I've upgraded an old cmsms site (1.10) to cmsms 2.1.3. In this site I had a module where I handled pretty urls in this way:
MyModule.module.php:
and I create pretty urls in action.default.php like so:
In new CMSMS 2.x accented characters are allowed, hence my urls have them, but those links lead to a 404 error.
I'm not able to find the reason why. Could someone give suggestions about this issue?
I also tried to use the method used in News module:
but it works only if use it for one url; if I use this method for routing all pretty urls I always got 404 errors.
Furthermore (please have pity) which is the convenience of using add_static vs add_dynamic routes ?
Thank you
MyModule.module.php:
Code: Select all
function InitializeFrontend() {
// All
$this->RegisterRoute('/[MyModule\/(?P<IDart>[0-9-]+)_(?P<returnid>[0-9]+)_l(?P<filter_loc>[0-9]+)_t(?P<filter_tipo>[0-9]+)\/(?P<order_by>[a-z]+)\/(?P<filter_period>[A-Za-z0-9-]+)\/(?P<aliased_title>[A-Za-z0-9-]+)$/',array('action'=>'art_detail'));
//only with order_by
$this->RegisterRoute('/[MyModule\/(?P<IDart>[0-9-]+)_(?P<returnid>[0-9]+)\/(?P<order_by>[a-z]+)\/(?P<aliased_title>[A-Za-z0-9-]+)$/',array('action'=>'art_detail'));
etc...
Code: Select all
$aliased_title = munge_string_to_url($row['Title'],true);
I'm not able to find the reason why. Could someone give suggestions about this issue?
I also tried to use the method used in News module:
Code: Select all
$route = new CmsRoute('/[MyModule\/(?P<IDart>[0-9-]+)_(?P<returnid>[0-9]+)_l(?P<filter_loc>[0-9]+)_t(?P<filter_tipo>[0-9]+)\/(?P<order_by>[a-z]+)\/(?P<filter_period>[A-Za-z0-9-]+)\/(?P<aliased_title>[A-Za-z0-9-]+)$/',array('action'=>'art_detail'));
cms_route_manager::add_dynamic($route);
Furthermore (please have pity) which is the convenience of using add_static vs add_dynamic routes ?
Thank you