문제

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?

도움이 되었습니까?

해결책

Just add the following route rule.

 $route['author/(:any)'] = "author/user/$1";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top