How to remove controller name from the URL in codeigniter?

前端 未结 4 580
南笙
南笙 2020-12-20 03:00

I have controller named “profile” and the URL for user profile is www.example.com/profile/user

I am already using the rerouting of codeigniter in the routes file

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-20 03:56

    You can use this in a route file:

    $route['(:any)'] = "controller_name/$1";
    $route['(:any)/(:any)'] = "controller_name/$1/$1";
    $route['(:any)/(:any)/(:any)'] = "controller_name/$1/$1/$1";
    

提交回复
热议问题