Maldivian mystery in Sitecore and returning 404 on unsupported languages

久未见 提交于 2019-12-11 23:38:12

问题


A website I am currently working on is currently responding to requests on http://www.mysite.com/dv with 301, where I would have expected a 404.

My site has no content item named DV, there is nothing in the site that corresponds to "DV", and I can't understand why on earth I am seeing this. I originally found these /DV/ URLs while looking at Google Webmaster Tools.

Then I used Fiddler to analyse the request and found

Response sent 26 bytes of Cookie data:
    Set-Cookie: wwwwebsite#lang=DV; path=/

This appears to correspond to the Maldivian language. I did not enable this language, and it does not appear under /system/Languages.

I then noticed I can also navigate to http://www.mysite.com/de-CH which is not an enabled language on my site either, leading me to believe I will get results like this for every non-enabled language.

Is there a way to return 404 for unsupported languages in Sitecore?


回答1:


Try seeing what your "languageEmbedding" value in the web.config is set to.

It can be set to the following: asNeeded | always | never

I would normally set it to "never" unless you have a site, which is set in multiplate languages, then set it to "always". The default is "asNeeded" which I frankly find kinda silly :)




回答2:


The issue you are having sounds similar to http://sdn.sitecore.net/Forum/ShowPost.aspx?postid=51681 but I an't find DV in LanguageDefinitions.config. I am also able to replicate your error so I don't think it is environment specific to your implementation. Would suggest you contact Sitecore Support.




回答3:


I don't believe this is actually related to languages at all. If you were to add any random characters in place of the DV, you'd still get a 302 redirect to a 404. Perhaps without the language cookie though.

You should follow the directions here to turn on server side error page redirects.

http://herskind.co.uk/blog/2012/03/sitecore-404-without-302



来源:https://stackoverflow.com/questions/16139102/maldivian-mystery-in-sitecore-and-returning-404-on-unsupported-languages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!