Handling IIS Error pages in Sitecore

Sitecore lets you direct errors, such as page not found, to other pages within Sitecore. This is good – it lets you have an error page with all your dynamic content (navigation menus, account details, etc).

You can patch this in with something like:

<?xml version="1.0"?>
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<!-- Default: /sitecore/service/notfound.aspx -->
<setting name="ItemNotFoundUrl">
<x:attribute name="value" value="/errors/Item Not Found" />
</setting>
<!-- Default: /sitecore/service/nolayout.aspx -->
<setting name="LayoutNotFoundUrl">
<x:attribute name="value" value="/errors/Item Not Found" />
</setting>
<!-- Default: /sitecore/service/notfound.aspx -->
<setting name="LinkItemNotFoundUrl">
<x:attribute name="value" value="/errors/Item Not Found" />
</setting>
<!-- Default: /sitecore/service/noaccess.aspx -->
<setting name="NoAccessUrl">
<x:attribute name="value" value="/errors/No Access" />
</setting>
<!-- Default: /sitecore/service/error.aspx -->
<setting name="ErrorPage">
<x:attribute name="value" value="/errors/Error" />
</setting>
</settings>
</sitecore>
</configuration>

Great, job done, right?

Nope…  Continue reading “Handling IIS Error pages in Sitecore”

Advertisement
Handling IIS Error pages in Sitecore

Handling 404s in Sitecore

Sitecore lets you specify a page to use for ‘ItemNotFound’ errors in web.config, and it’s always good practice to have a pretty ‘page not found’ page:

<setting name="ItemNotFoundUrl" value="/404" />

However, Sitecore hasn’t always been the best for actually returning the right HTTP status code for the 404 page. It redirects (more on that later) your failed request to a specified page in Sitecore – but the serves that page correctly, including an HTTP 200 status. This is sad, as search engines don’t understand that the page actually hasn’t been found. Continue reading “Handling 404s in Sitecore”

Handling 404s in Sitecore