[英]How to remove/hidden controller name from url in codeigniter
这是我的网址。 所以我该如何删除/隐藏
home/post
从网址
http://localhost/likes/home/post/sports/Secret-Weapons-for-Top-NFL-Teams-/13
和
admin/ad_managment
从
http://localhost/likes/admin/ad_managment/edit/2
谢谢
试试这个,我还没尝试过应该能用,
$route['(:any)/(:num)'] = "admin/ad_managment/$1/$2";
$route['(:any)/(:any)/(:num)'] = "home/post/$1/$2/$3";
查看更多http://ellislab.com/codeigniter/user-guide/general/routing.html
查看codeigniter的用户指南,并在此示例中查看路由的完成方式。 阅读有关代码点火器路由的更多信息
写入application/config/routes.php
$route['(:any)/(:any)/(:num)'] = "home/post/$1/$2/$3";
现在,您可以使用以下格式:
http://localhost/likes/sports/Secret-Weapons-for-Top-NFL-Teams-/13
Uri路由文档: http : //ellislab.com/codeigniter/user-guide/general/routing.html
使用.htaccess重写网址。
http://www.pets.com/pet_care_info_07_07_2008.php
RewriteEngine On#打开重写引擎
RewriteRule ^ pet-care /?$ pet_care_info_01_02_2008.php [NC,L]
#处理“宠物照管”的请求
https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.