About this article
|Written by:||Imar Spaanjaars|
|Posted:||6/14/2010 9:24 AM|
Rate this article
About the author
Imar Spaanjaars is the owner of De Vier Koeden, a company specializing in consultancy and development on the Microsoft .NET platform and Dynamicweb.
Interested in custom development or consultancy on Dynamicweb or .NET? Then contact De Vier Koeden through the Contact page.
Follow Imar on Twitter if you want to be notified of new articles in this Dynamicweb series.
Assigning a Custom 404 Page to Each Web Site
Assigning the Custom 404 Page
In the new 7.1 release, the Language / Area module has been renamed to Websites to better describe its intended purpose. However, all functionality previously found in Language / Area is still present in Websites. Better yet, you can now assign a custom 404 page to each web site as follows:
Choose Modules from the main menu on the left of the Dynamicweb Admin interface and then click the Websites module.
Right-click the web site to which you want to assign a custom 404 page and choose Edit. If you only have a single web site and want to follow along with this article, click Copy on the Ribbon first and create a copy of the existing web site. Notice the new "Update Links" section in this dialog that enables you to create a copy of web site while maintaining all relative links to internal pages. This option is discussed in a future blog post.
Next, under HTTP 404 browse to the page in the current web site that you want to display when a 404 error occurs. In Figure 1 you can see how I selected the 404 page in the US English site (click for a larger version of the image).
Make sure that under Domain at least one domain name is entered that should be used for the current Dynamicweb web site. In my case, my English site uses the domain name test.devierkoeden.com while the Dutch site uses test.devierkoeden.nl.
Click Save and close to apply your changes.
- Repeat steps 2 through 5, but now configure your other web site(s), each time choosing a 404 page that is specific to that web site / language layer.
With all changes saved, each domain name should now show a custom 404 page when you request a page that does not exist. The 404 page is specific for the web site that generated the error. Figure 2 shows the Custom 404 page for the Dutch language layer. Notice the .nl top level extension in the address bar (click for a larger version of the image):
If you switch to another web site (such as the .com version of the domain in my example) and request a page that does not exist, you should see a screen similar to Figure 3 (click to enlarge):
Caveats and Wrapping Up
If you want to assign a custom 404 like this on a Dynamicweb installation with only a single web site (with or without the Websites module enabled), it's still important to enter a domain name in the Website Settings dialog visible in Figure 1. Without it, Dynamicweb won't be able to relate the custom 404 to the right domain. If you can't, or don't want to assign a specific domain name (which is common with sites that listen to multiple host headers configured in IIS), you can simply use the old 404 functionality that you find under Management Center | System | Solution Settings.
It's a small change in functionality, but a very welcome one. This new feature now makes it very easy to assign custom pages, without the need for complex custom development, or a messy client-side solution.