简体   繁体   English

Codeigniter路由删除控制器

[英]Codeigniter Routing remove controller

I want to route so that the "domain" part dissapears, 我要进行路由,以使“域”部分消失,

http://www.domaininfo.za/domain/google.com

to something like this 像这样

http://www.domaininfo.za/google.com

I have managed to remove the welcome part but how do i remove domain? 我设法删除了欢迎部分,但是如何删除域?

my route file: 我的路线文件:

$route['default_controller'] = "welcome";
$route['404_override'] = '/';
$route['(:any)'] = "welcome/domain/$1";

不确定这是否是您要的内容,但这对您有用吗?

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

Your routing is dangerous...I would put a regex in the route key to recognize web domains, then route it to welcome/domain/$1. 您的路由很危险...我会在路由键中放置一个正则表达式以识别Web域,然后将其路由到Welcome / domain / $ 1。 Right now you are routing all values in the controller space to welcome/domain/$1. 现在,您正在将控制器空间中的所有值都路由到Welcome / domain / $ 1。 Mod-rewrite or using regex in your router would be best. 最好在路由器中进行Mod-rewrite或使用regex。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM