CodeIgniter Forums
Routing question - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: Routing question (/thread-6383.html)

Routing question - El Forum - 02-25-2008

I want to make path like /users/25345. Is there a way to do it?

(i heard, based on codeigniter?)

Routing question - El Forum - 02-25-2008

You can do this using routing
$route['user/:num'] = 'users/profile/$1';
$route['user/:num/photos/:num/:num'] = 'users/photos/$1/$2/$3';
It's best to build your urls in a manner users can remember the urls so make them as consistent as possible. Make them also as short as possible. The longer they are the more users have to remember.

Because you want to have /users/25345 to begin with i based the second url on that. I wrote users in singular form because you are going to see the data for that particular user not for a group of users. I also removed the view segment because that is the default action for a page. Seeing /users/view/12323/photos/23/54 i'm confused on what i'm exactly getting to see on that page. /users/12323/view/photos/23/54 makes more sense, not?

You do it how you like it of course but because urls are public it's best not to mirror your classes and methods.

Routing question - El Forum - 02-25-2008

thank you, xwero!