强制语言preFIX与Sitecore的网址 [英] Force a language prefix in the url with Sitecore
问题描述
有没有设置强制在URL中的语言?就像,如果我浏览到 http://www.site.com ,我应该被重定向到的 http://www.site.com/en ,因为它是现在我可以看到起始页而不语preFIX。
Is there a setting to force the language in the URL? Like, if I browse to http://www.site.com, I should be redirected to http://www.site.com/en, as it is now I can see the start page without the language prefix.
的 LinkManager
配置为始终把在preFIX因此,所有的链接看起来罚款最少。
The LinkManager
is configured to always put in the prefix so all the links look fine at least.
推荐答案
用另一种方式是我们的 SEO友好的URL模块。
Another way to use is our SEO Friendly URL Module.
本模块实现自定义的 LinkProvider
,提供SEO友好的URL和部队的项目,通过其友好的URL来访问。结果
因此,如果一个项目是在URL中不含语言code访问(例如 /我的项目
),该模块将301重定向到与语言code中的URL (例如: / EN /我的项目
)。结果
也就是说,如果用户已经配置给力友好的URL( forceFriendlyUrl =真正的
),并设置 languageEmbedding =总是
。
This module implements a custom LinkProvider
that provides SEO Friendly URL's and forces items to be accessed through their friendly URL.
So if an item is accessed without the language code in the URL (e.g. /my-item
) the module will 301 redirect to the URL with language code (e.g. /en/my-item
).
That is, if you have configured it to force friendly URL's (forceFriendlyUrl="true"
) and set languageEmbedding="always"
.
我们使用该模块上我们的企业网站,所以来看看,要看到它在行动。
We use that module on our corporate website, so take a look at that to see it in action.
这篇关于强制语言preFIX与Sitecore的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!