开发者

Codeigniter Routing remove controller

开发者 https://www.devze.com 2023-04-11 20:35 出处:网络
I want to route so that the \"domain\" part dissapears, http://www.domaininfo.za/domain/google.com to something like this

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";


Not sure if this is what you're asking, but does this work for you?

$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. Right now you are routing all values in the controller space to welcome/domain/$1. Mod-rewrite or using regex in your router would be best.

0

精彩评论

暂无评论...
验证码 换一张
取 消