• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Route extension: default request

In 1.6.1 I've gotten wildcard urls to work. In fact, the following route, added last (except for 'default_controller' and 'scaffolding_trigger') solves the problem entirely update: ...not quite - see next post. No need for the extended router.update: yes there is, but it needs a slight mod

$route['([^/]+)'] = 'pages/read/$1';

It's entirely possible that this worked in my original version of CodeIgniter, and that I somehow just managed to mess up the code.

Another update:

while the above solution works in most cases, it breaks the index functions (because the routes are processed before resolving controller/method). Hence, the extension above is useful (does processing just before 404).

However the extended router needs modification for 1.6.1: they changed the name of the function "_validate_segments" to "_validate_request". Just changing the name (2 places) in the code of the extended router given in the first post, will make it work again.

I had some issues with the following working:

$route['manage/(.*)'] = "user/$1";

But it does work as
$route['manage(.*)'] = "user$1";

The only one issue with this way is if you access site.com/management/person it will be treated as site.com/userment/person

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.