简体   繁体   中英

Codeigniter routing is not working

hello I need to route that

/tagi/fotografia,51/ to /galeria-sztuki-nowosci/?tags=51

this is only example ofc. My code in routes.php is :

$route['tagi/(:any),(\d+)'] = function($id) {
    return 'galeria-sztuki-nowosci/?tags=$id';
};

and it's not working.

First of all, Need to add comma in config.php

$config['permitted_uri_chars'] = 'az 0-9~%.:_-,';

next routes.php will be

$route["tagi/([az]+),(:any)"] ='old/galleryTags/$2';

And last need to do controller with

public function galleryTags($tags) {

    if ($tags == "_"): $tags = ""; endif;


    header("Location: /galeria-sztuki-nowosci/?tags=$tags");
}

done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM