cakephp问题中的多种语言
我正在尝试根据本教程建立一个多语言网站:
从点击切换语言链接的效果来看,事情看起来不错。但是,当您第一次访问该网站时,我希望它转到默认语言 example.com/eng/
而不是 example.com/
。
基本上,出于搜索引擎优化的目的,我不希望我的网站有非语言内容,应该始终在网址中包含该语言。
我怎样才能做到这一点,并完成在会话/cookie 中保存语言的功能?
谢谢
I am trying to get a multilingual site up according to this tutorial:
http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/
Things look good in terms that clicking on a switch-language link works. However, when you first come to the site, i would like it to go to the default language example.com/eng/
instaed of just being example.com/
.
Basically, for SEO purposes, I don't want my site to have non-lingual content, should always have the language in the url.
How could I do that and also go through the function that saves the language in session/cookie?
thanx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这篇文章,您所需要的只是简单检查 URL 中的“语言”参数:
Looking at the article, all you should need is a simple check for the 'language' param in the URL: