CodeIgniter Forums

Full Version: underscore with hyphens
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Controller and Method are supporting _
But it is not nice to see in url.

I want hyphens in url. Is that possible?
So url will be having only hyphens instead of underscore
(04-08-2015, 07:59 AM)agriz Wrote: [ -> ]Controller and Method are supporting _
But it is not nice to see in url.

I want hyphens in url. Is that possible?
So url will be having only hyphens instead of underscore

A simple

PHP Code:
$route['request-guide'] = "request_guide" 

will do this for you.
Yes you'd need to create routes like suhindra showed. It's because the url maps directly to a controller, which is a php class. PHP class names can't have a dash in them as PHP interprets it as subtraction.
... or you can use CI3 and just set $route['translate_uri_dashes'] to TRUE.
$route['request-guide'] = "request_guide" ;

this will work.
(04-08-2015, 10:55 AM)Narf Wrote: [ -> ]... or you can use CI3 and just set $route['translate_uri_dashes'] to TRUE.

I am using CI3. I will check this out.
(04-08-2015, 10:55 AM)Narf Wrote: [ -> ]... or you can use CI3 and just set $route['translate_uri_dashes'] to TRUE.


In localhost it works. But in my production server does not. Show error 404.

I have to do some configuration on the server?