CodeIgniter allow hyphen in url? -
i have tried following, unfortunately not work:
$route['request-guide'] = "request_guide";
in application/core created my_router.php, not working.
<?php defined('basepath') || exit('no direct script access allowed'); class my_router extends ci_router { function _set_request ($seg = array()) { // str_replace() below goes through our segments // , replaces hyphens underscores making // possible use hyphens in controllers, folder names , // function names parent::_set_request(str_replace('-', '_', $seg)); } } ?>
open file /application/config/routes.php , add following line in route array.
$route['translate_uri_dashes'] = true;
it automatically translate my_controller my-controller or in small letters.
Comments
Post a Comment