Tag Archives: 404

Lower-casing Rewrite Rules Breaks The Sitecore Client

Problem

I was asked to look at a Sitecore solution, where it was not possible to show a custom application in the sitecore client. In fact it was not possible to show a number of the standard dialog’s, for example the presentations dialog (see the image above).

It was strange as some dialog’s worked and others did not, so I opened the developer tools which immediately showed me what the issue was.

As you can see a lot of stuff is missing? This is because Sitecore’s HTTP handler is looking for URL’s that begin with “WebResource.axd” and it is case sensitive.

Rewrite Rules Strike Again

To improve SEO, the following rewrite rule was introduced in the web.config to lower case ALL url’s 

Now whilst this was great for the websites SEO; it was responsible for breaking the sitecore client as there are a number of URL’s which are case sensitive.

Solution

The solution was to identify all the case sensitive sitecore client URL’s and exclude them from the lowercase rule.

Now instead of trying to write the most complex regular expression ever, which would catch all the website URL’s and avoid all the Sitecore client calls.

I decided to add an individual condition match pattern for each (URL) and then used the negate=true to exclude the URL from the redirect rule.

Ignore POST requests

Thanks to Søren Kruse for pointing this out; The redirect will change a POST requests to a GET and you will lose any data in the body of the original request. Therefore you should ensure that POST requests are not redirected.

<add input="{REQUEST_METHOD}" matchType="Pattern" pattern="POST" ignoreCase="true" negate="true" /><span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>

Well I hope this helps, Alan