Question

Normally in Codeigniter a url by default has two to three segments like this. http://www.yoursite.com/controller/function

My question is, can I replace that function segment for a value if my code is in the index part of the controller.

I have a controller for just user profiles and I'm trying to make that the simplest url possible, so it's easily sharable. For example I would like the url to be something like this http://www.mywebsite.com/author/zazvorniki instead of having to call a function like this. http://www.mywebsite.com/author/user/zazvorniki

Is this possible? Is there a setting I can change to make this possible?

Was it helpful?

Solution

Just add the following route rule.

 $route['author/(:any)'] = "author/user/$1";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top