与 Codeigniter 一样,假设我有$route['default_controller'] = "welcome";
,如果我请求左侧的 url,我将使用右侧列出的控制器:
www.foo.com/ => applications/controllers/welcome.php with method "index"
www.foo.com/bar => applications/controllers/bar.php with method "index"
www.foo.com/bar/baz => applications/controllers/bar.php with method "baz"
这一切都在预料之中。但是当使用子域时,我想让codeigniter在与子域同名的子目录中使用控制器:
abc.foo.com/ => app/controllers/abc/welcome.php with method "index"
abc.foo.com/baz => app/controllers/abc/baz.php with method "index"
abc.foo.com/baz/qux => app/controllers/abc/baz.php with method "qux"
这可以通过路线完成吗?如果是这样,您如何根据子域设置路由?
或者有没有更简单的方法来做到这一点?