NOTE: I'm not talking about removing
index.php
- I meanindex
- the method name.
我当前的 URL 如下所示:
www.mysite.com/view-topic/index/my-topic
这是我想要的样子:
wwww.mysite.com/view-topic/my-topic
我该怎么做?
提前致谢!
最佳答案
你可以为此设置路由,在application/config/routes.php
中,添加一个新行:
$route['view-topic/(:any)'] = 'view-topic/index/$1';
这将路由您的 URL http://url.com/view-topic/anythinggoeshere
将屏蔽 view-topic/index/anythinggoeshere
Controller 。
关于路由的更多信息:
关于php - CodeIgniter - 从 URL 中删除 "Index",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13734921/