IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
Use this article to configure handling custom errors using Sitefinity CMS pages, where each site or each language has its own version of the custom error page.
IMPORTANT: The instructions provided below require you to put an MVC or WebForms widget, respectively, that sets the status code to 404. Otherwise you might compromise your website SEO ranking. For more information see Use a Sitefinity CMS MVC page as a custom error page and Use a Sitefinity CMS WebForms page as a custom error page.
When managing more than one website in your Sitefinity CMS project (Multisite), you can have a different custom error page for each site. This enables you to modify the custom error page according to the specific website needs, for example apply different design.
As long as each of your websites has a custom error page with a URL matching the one you have specified when configuring your custom errors in the web.config, Sitefinity CMS will serve the proper page for the corresponding site. For more information see: Custom error pages.
For example, if you have 2 sites - https://myfirstsite.com, and https://mysecondsite.com, and each of them contains a custom errors page with a URL https://myfirstsite.com/404 and respectively https://mysecondsite.com/404, and your custom errors have been configured to handle the 404 status code by serving a page with URL /404, then as long as users browsing https://myfirstsite.com encounter a resource not found (404) error, https://myfirstsite.com/404 error page will be served, and the ones, who encounter a 404 error on https://mysecondsite.com will get the https://mysecondsite.com/404 page served.
If your site has more than one languages defined, you might want to offer users a friendly custom errors page for the current language version of the site. To achieve this you must introduce different custom errors configurations in your we.config using the <location> tag. The <location> tag enables you to specify different configuration behavior for different sections of your website. By default, Sitefinity CMS uses a prefix (directory) to resolve each language for the site. For example, the Bulgarian language version of the content will be served on https://mysite.com/bg/. You can use the language prefix to specify the path for the <location> tag, and thus have the configuration inside apply only for the /bg/ path. The following sample demonstrates the above described configuration:
<location>
For more information on configuring <location> tags in your web.config, see: MSDN: How to: Configure Specific Directories Using Location Settings.
NOTE: If your website is using different domains (for example, https://bg.mysite.com and https://us.mysite.com) to serve multilingual content, you do not need to follow the approach for configuring a <location> tag, described above. You can have one configuration for custom errors in your web.config, and different translations of your custom error pages for each language. As long as the URLs of your custom error pages match in each language, the proper page will be served for the current language domain users are browsing. This is because the specified paths are relative and are always resolved for the current domain. For more information about configuring how the multilingual URLs behave, see: Language settings.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important