0

I'd like some help please.

I have set up some routes like this:

$route['controller/some-method/(:any)'] = 'controller/some_method/$1';

I was wondering if it is a more efficient way of doing this, instead of typing all of my routes one at the time, like creating a single route where all the controller or method names that have underscores make them dashes.

So basically what I want is to set all my urls to have dashes instead of underscores.

ltdev
  • 4,037
  • 20
  • 69
  • 129
  • possible duplicate of [Codeigniter Routes regex - using dashes in controller/method names](http://stackoverflow.com/questions/2428134/codeigniter-routes-regex-using-dashes-in-controller-method-names) – GluePear Sep 03 '15 at 16:49

1 Answers1

2

As per the Codeigniter Specifications, changing the following line to TRUE in routes.php will translate underscores to dashes.

$route['translate_uri_dashes'] = TRUE;

Codeigniter API Docs - Routing

acupofjose
  • 2,159
  • 1
  • 22
  • 40