php CodeIgniter:如何设置默认页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31851767/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CodeIgniter: How to set the default page
提问by user4269288
I have created a multilingual website with CodeIgniter and now I would like to change the default url www.myebsite.cominto www.mywebsite.com/en/home.
我已经使用 CodeIgniter 创建了一个多语言网站,现在我想将默认网址www.myebsite.com更改为www.mywebsite.com/en/home。
How can I change it?
我怎样才能改变它?
回答by Ilanus
Navigate to application/config/routes.php
导航 application/config/routes.php
Find $route['default_controller']
找 $route['default_controller']
And Replace to:
并替换为:
$route['default_controller'] = 'my-controller/my-method';
回答by mariek
You can use the default controller to redirect to /en/home :
您可以使用默认控制器重定向到 /en/home :
class Welcome extends CI_Controller {
public function index()
{
redirect('en/home');
}
}
回答by user11317055
$route['default_controller'] = 'my-controller/my-method';