2
當我登錄我的主頁www.domain.com(默認控制器'home')時,瀏覽器重定向到www.domain.com/en/home。我想看到的是www.domain.com/en(谷歌將看到這些頁面,我認爲重複的內容?)無法使用多語種代碼的URL刪除默認控制器
是否有可能離開URL的默認控制器,以便只有語言跟隨域名即www.domain.com/en?
這裏是我下面的代碼:
$route['default_controller'] = "Home";
$route['404_override'] = '';
// '/en', '/es' URIs -> use default controller
$route['^(en|es)$'] = 'home'; //$route['default_controller']; //'home'
// route es translation of girls to girls
$route['es/chicas'] = "girls";
$route['es/chicas/chica/(:num)/(:any)'] = "girls/girl/$1/$2";
$route['es/chicas/etiquetas/(:num)/(:any)'] = "girls/tags/$1/$2";
// movies es routes
$route['es/peliculas'] = "movies";
$route['es/peliculas/pelicula/(:num)/(:any)'] = "movies/movie/$1/$2";
$route['es/fotos/galeria/pelicula/(:num)/(:any)'] = 'photos/gallery/movie/$1/$2';
$route['es/peliculas/etiquetas/(:num)/(:any)'] = "movies/tags/$1/$2";
$route['es/unirse'] = "join";
// general catch all for anything that doesn't fit rules above, but doesn't have a
// language prefix e.g. en/girls -> girls controller
$route['^(en|es)/(.+)$'] = "$2";
你可以告訴你,你是如何實現這個網址www.domain.com/en/home。 –
是的,對不起,我原本應該發佈代碼。我沒有修改我原來的帖子來包含代碼。 – user2582977
嘗試把$ route ['^(en | es)$'] ='home';在$ route ['default_controller'] =「Home」之前;我認爲$ route ['default_controller'] =「Home」;不需要,因爲你已經在$ route ['^(en | es)$'] ='home'還對base_url的配置文件進行更改。嘗試將es或en默認爲url。 –