[英]Remove or hide controller name from url in codeigniter
How can I remove controller name from url . 如何从url中删除控制器名称。 I have two controller
我有两个控制器
home and admin
and the url's are 和网址是
http://domain.com/likes/home/post/sports/20-Athletes-Who-Profited-While-in-College-/12
home/post
and 和
http://domain.com/likes/admin/ad_managment/edit/2
http://domain.com/likes/admin/meta_tags_home/edit/2
admin/ad_managment admin/meta_tags_home
I have already used this 我已经用过了
$route['(:any)/(:any)/(:num)'] = "home/post/$1";
It works for this URL 它适用于此URL
http://domain.com/likes/home/post/sports/20-Athletes-Who-Profited-While-in-College-/12
admin is not working. 管理员无法正常工作。 Basically I want to remove home/post Leave admin controller it doesn't matter
基本上我想删除家庭/职位离开管理员
尝试这个
$route['(:any)/(:any)/(:any)'] = "home/post/$1";
Try this example 试试这个例子
$config['base_url'] = 'http://your-site.com/';
And in your routes.php
$route['default_controller'] = 'main';
Through this method you can remove controller name from url. 通过这种方法,您可以从url中删除控制器名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.