gpt4 book ai didi

php - 无法使用多语言 codeigniter 摆脱 URL 中的默认 Controller

转载 作者:行者123 更新时间:2023-12-05 08:00:40 27 4
gpt4 key购买 nike

当我登陆我的主页 www.domain.com(使用默认 Controller “home”)时,浏览器重定向到 www.domain.com/en/home。我想看到的是 www.domain.com/en(我认为谷歌会将这些页面视为重复内容?)

是否可以将默认 Controller 留在 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";

最佳答案

这是关于你的 config/route.php 文件。完全按照您的需要更新您的路线。

关于php - 无法使用多语言 codeigniter 摆脱 URL 中的默认 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17651398/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com