CodeIgniter Forums
Route rewriting length - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Route rewriting length (/showthread.php?tid=51912)



Route rewriting length - El Forum - 05-23-2012

[eluser]Unknown[/eluser]
Hi all,
I'm having a bit of trouble, I'm trying to do a custom route, I've done this...

'admin/([a-z]+)' => 'admin/area/$1'

The above works great for 'admin/something', 'admin/whatever', 'admin/etc'
However, if I just visit 'admin/' then it is also routing to 'admin/area/$1'

I've tried this...

'admin/([a-z]{1,}+)' => 'admin/area/$1'

But I get the same result.

Any suggestions
Thanks!


Route rewriting length - El Forum - 05-23-2012

[eluser]InsiteFX[/eluser]
Note: Routes will run in the order they are defined. Higher routes will always take precedence over lower ones.
Code:
$route['default_controller'] = 'welcome';
$route['404_override'] = '';

$route['admin/([a-z]+)'] = 'admin/area/$1';
$route['admin'] = 'admin';