当我登陆我的主页 www.domain.com(使用默认控制器“home”)时,浏览器会重定向到 www.domain.com/en/home。我想看到的是 www.domain.com/en (我认为谷歌会将这些页面视为重复内容?)
是否可以将默认控制器排除在 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";