Skip to content


Subversion checkout URL

You can clone with
Download ZIP


feature request for reverse routing #1293

shijialee opened this Issue · 2 comments

3 participants


New to php and CI... I would hate to hard-code url in my template. a way to reverse mapping the routes from config/routs.php would be really nice.

Looks like there isn't such feature in CI and I found one here it is "an extension for the CodeIgniter Router class that I wrote that gives you a nice way to write routes that are reversible and also have the ability to take parameters."

What do you think?


This is an interesting feature. I can see the desire for it, but I think that desire comes at a price.

This feature's purpose is to make changing URLs easy, without needing to replace code in multiple places. That's always handy, but what happens when you change a URL on a website that is well-established? How will Google know where the new page is? How will your users? I think this makes it easy for people to forget to set up appropriate HTTP redirects and that sort of thing.

Some other things of note:

  • Conflicts of someone utilizes both (:num) and (:any) for the same route.
    $route['something/(:num)'] = 'something/number/$1';
    $route['something/(:any)'] = 'something/else/$1';

  • Regular Expression support (I didn't look too closely at the code in the link, but noticed that it said he ignores the CI default :num & :any.

  • This would also need to be a major release addition, since it requires the rewrite of the Routes config file.

Personally, I have never had an issue hardcoding URLs into an application. But I can see how this would be handy. I think it could use some more discussion.


Closing this as duplicate of #218.

@narfbg narfbg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.