Welcome Guest, Not a member yet? Register   Sign In
underscore with hyphens
#1

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
Reply
#2

(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.
Reply
#3

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.
Reply
#4

... or you can use CI3 and just set $route['translate_uri_dashes'] to TRUE.
Reply
#5

$route['request-guide'] = "request_guide" ;

this will work.
Reply
#6

(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.
Reply
#7

(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?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB