简体   繁体   中英

CodeIgniter: How to set the default page

I have created a multilingual website with CodeIgniter and now I would like to change the default url www.myebsite.com into www.mywebsite.com/en/home .

How can I change it?

Navigate to application/config/routes.php

Find $route['default_controller']

And Replace to:

$route['default_controller'] = 'my-controller/my-method';

You can use the default controller to redirect to /en/home :

class Welcome extends CI_Controller {

    public function index()
    {
        redirect('en/home');
    }
}
$route['default_controller'] = 'my-controller/my-method';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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