Tag: HttpRequestBegin

Sitecore: 404 without 302.

Sitecore: 404 without 302.

This post shows how to handle a request for a page which is not found, how to avoid having the request being redirected with a 302 status code before a 404.

How Sitecore handle NotFoundItem

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" />

When Sitecore can’t find the requested item, it will redirect the user to the page that is configured in the setting ItemNotFoundUrl.

However, during the redirecting the response returns an HTTP status code 302 (Moved Temporarily). This is sad, as search engines don’t understand that the page actually hasn’t been found.

For search engine optimization, you should return the HTTP 404 status code for any invalid URL by setting the Status property of the current System.Web.HttpResponse

Continue reading “Sitecore: 404 without 302.”

Avoid displaying pages without a language version

The Sitecore CMS allows you to create multiple versions of the pages for each of the languages supported by your site. Still, sometimes you may want to have particular pages translated into to a certain subset of the languages, e.g. if you have French content that should be available for end users in just France and Canada. The problem is that when you try to access the page in a language which does not have a supported version, you won’t get a 404 error, but be displayed an empty page.

Continue reading “Avoid displaying pages without a language version”