Codeigniter URL

Is there any way to create user urls? sort of

www.domain.com/username

I know that I probably need to use a route system, and I often use this for other URL requests. But the fact is, I need a username in order to dynamically create a user profile, if one exists. But do I also need to consider my other controller classes?

Thank!

+3
source share
1 answer

I see that you understand that the user can step over all of your existing routes by creating the corresponding username.

, ( ):

// Route everything to users profile
$route['(:any)'] = 'users/profile/$1';

// Route all requests after "my_trigger" as normal
$route['my_trigger/(:any)'] = '$1';

* , /(:any) .

, my_trigger , .

, , , "", . , /blog /trigger/blog.

, , url, /u/username, , ?u=username.

- , , , .

, - , "" (.. ).

+3

All Articles