简体   繁体   中英

CodeIgniter routes.php using RegExp

I have url this type:

/12,434/

routes.php contain:

$route['default_controller'] = "home";
$route['404_override'] = '';
$route['([0-9\,]+)']="route/index/$1";

Url /12,434/ open 404 page. How fix it?

I think you need to include the forward slash within character class,

$route['([0-9\,\/]+)']="route/index/$1";

DEMO

You should allow comma in URL from application/config/config.php file:

$config['permitted_uri_chars'] = 'a-z 0-9~%.,:_\-';
                                            ^ added here

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