CodeIgniter icon indicating copy to clipboard operation
CodeIgniter copied to clipboard

Routing Issue

Open natepizzle opened this issue 12 years ago • 4 comments

According to CI3 Documentation: With regular expressions, you can also catch a segment containing a forward slash (‘/’), which would usually represent the delimiter between multiple segments. For example, if a user accesses a password protected area of your web application and you wish to be able to redirect them back to the same page after they log in, you may find this example useful:

$route['login/(.+)'] = 'auth/login/$1'; That will call the “auth” controller class and its login() method, passing everything contained in the URI after login/ as a parameter.

www.example.com/cdn/site/css/animations.css $route['cdn/(.+)'] = 'cdn/retrieve/$1';

Ideally this should call Cdn controller, retrieve method, and passing 'site/css/animations.css' as an argument. However, only 'site' is passed as argument.

natepizzle avatar Aug 20 '14 16:08 natepizzle

http://php.net/manual/en/function.func-get-args.php

kakysha avatar Aug 20 '14 16:08 kakysha

Confirmed.

CI_Router went through a major overhaul and that feature probably got broken at that point.

narfbg avatar Aug 20 '14 17:08 narfbg

Using uri_string() as temp workaround

natepizzle avatar Aug 21 '14 19:08 natepizzle

Turned out such a feature was never implemented, I've just interpreted the regexp routes-to-parameters translation the wrong way at the time. Hence, it was a documentation problem and uri_string() is the way to do what you want. Thanks for reporting it.

narfbg avatar Aug 27 '14 12:08 narfbg