Sitecore

Sitecore and Bundling


A short note on Sitecore and Bundling.

If you use Bundling within your WebApplication you will maybe wondering why your Script and css files not rendered properly:

 Failed to load resource: the server responded with a status of 404 (Not Found)
 http://YourDomain/sitecore/service/notfound?item=%2fbundles%2fmodernizr&user=sitecore%5cadmin&site=YourSiteName

or

 Failed to load resource: the server responded with a status of 404 (Not Found)
 http://YourDomain/sitecore/service/notfound?item=%2fcontent%2fcss&user=sitecore%5cadmin&site=YourSiteName

Sitecore tries to resolve your Bundles as an item. But you can get rid of this with a simple setting adjustment in web.config.

<setting name="IgnoreUrlPrefixes" value="/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing" />

Here we go! Just add your bundle-urls pipe-separated to the IgnoreUrlPrefixes-value

<setting name="IgnoreUrlPrefixes" value="/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing|/bundles|/Content/css" />

Best practise:

It’s highly recommended to patch such Settings in your own Settings.config-file in App_Config/Include-Folder like this:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
   <settings>
       <!-- IGNORE URLS
       Set IgnoreUrlPrefixes to a '|' separated list of url prefixes that should not be
       regarded and processed as friendly urls (ie. forms etc.)
       -->
       <setting name="IgnoreUrlPrefixes">
         <patch:attribute name="value">/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing|/bundles|/Content/css</patch:attribute>
       </setting>
     </settings>
   </sitecore>
</configuration>

1 Comment

  1. This post is very informative but it took me a long time to find
    it in google. I found it on 19 spot, you should focus on quality backlinks
    building, it will help you to increase traffic. And i know how to help you, just type in google – k2 seo tips and tricks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.