Getting Sitecore 404 for physical files

别说谁变了你拦得住时间么 提交于 2019-12-02 05:28:10

问题


The media library URL (/sitecore/shell/Applications/Media/MediaShop/default.aspx) is being picked up by the SiteCore handler and redirected to the page-not-found page Sitecore uses (/sitecore/service/notfound.aspx). The file is a physical file and is actually there. I've seen things like this happen with items in the Sitecore content tree, but not with physical files. Any ideas where to look would be appreciated. Thanks.

Update: So, the issue as described above is fixed, but it's clear that there are other problems, seemingly also media related. This file: /sitecore/shell/applications/media/mediafolder/mediafolder.js is showing the same symptoms I've described above. They file is there on the server, but Sitecore is redirecting to it's 404 page.


回答1:


Ok...here it is: Found this line in the web.config:

<handler trigger="/media/" handler="sitecore_media.ashx"/>

Which should be this:

<handler trigger="~/media/" handler="sitecore_media.ashx" />

After I made that change, everything worked great.




回答2:


It looks like the physicalFolder attribute of your sites configuration is not set properly.

 <site 
    name="helloworld"
    hostName=www.helloworld.com
    virtualFolder="/virtual"
    physicalFolder="/hello" 
    rootPath="/sitecore/content"
    startItem="/Hello Home"
    language="en" 
    database="web" 
    domain="extranet" />

Double check if this parameter for the site is set properly. According to the Sitecore documentation, the files stored in the physical folder always take precedence over the Sitecore Items. Here are some details about the physicalFolder part of the sites config:

site Attribute Properties: physicalFolder

If it's not a problem with the sites configuration you may try to put a txt file or an image in the same directory and check whether Sitecore serves them properly.




回答3:


I apologize if this is patronizing, but I'll post it anyway in case it helps.

Have you registered the path to be ignored in the "IgnoreUrlPrefixes" setting? I don't see that anyone has mentioned that, but perhaps that's because it's obvious.

<setting name="IgnoreUrlPrefixes" value="/sitecore/shell/Applications/Media/MediaShop/default.aspx" />


来源:https://stackoverflow.com/questions/16658047/getting-sitecore-404-for-physical-files

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