如何从codeigniter中的url中删除/隐藏控制器名称
This belove is my url. so how can i remove/hidden
home/post
from the url
http://localhost/likes/home/post/sports/Secret-Weapons-for-Top-NFL-Teams-/13
and
admin/ad_managment
from
http://localhost/likes/admin/ad_managment/edit/2
thanks
这个belove是我的网址。 那么如何从网址 p> 中删除/隐藏 p>
home / post
code> pre>
的http://本地主机/喜欢的/ home /后/运动/秘密武器换顶NFL-Teams- / 13
代码> 预>
和 p>
admin / ad_managment
code> pre>
来自 p>
http:// localhost / likes / admin / ad_managment / edit / 2
code> pre>
谢谢 p>
div>
check user guide of codeigniter and in this example see how the routing done. Read more about code-igniter routing
Write into application/config/routes.php
$route['(:any)/(:any)/(:num)'] = "home/post/$1/$2/$3";
And now, you can use like following format:
http://localhost/likes/sports/Secret-Weapons-for-Top-NFL-Teams-/13
Uri Routing Document: http://ellislab.com/codeigniter/user-guide/general/routing.html
Try this I haven't tried this should work,
$route['(:any)/(:num)'] = "admin/ad_managment/$1/$2";
$route['(:any)/(:any)/(:num)'] = "home/post/$1/$2/$3";
See more http://ellislab.com/codeigniter/user-guide/general/routing.html
use .htaccess to rewrite the url.
http://www.pets.com/pet_care_info_07_07_2008.php
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^pet-care/?$ pet_care_info_01_02_2008.php [NC,L]
# Handle requests for "pet-care"
https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/