How to Create Custom Error Documents and Custom 404 Errors

How to Create Custom Error Documents and Custom 404 Error Pages
There are two types of error pages that exist:
  • IIS Error Pages which are error pages that handle IIS-level errors such as when it attempts to load an HTML file that does not exist.
  • ASP.NET Error Pages which handle ASP.NET errors and are managed separately from IIS error pages.
If you need to create custom error pages, or more commonly, custom 404 error pages, follow the instructions below.
 
Notes: 
Error documents can only be configured on a per-DNN installation basis and can not be configured on a per-portal basis.

 
Method One: Configuring IIS Error Pages.
You must first create and upload your error pages to the httpdocs folder of your domain via FTP. If you are unsure how to do this please refer to How to Use FTP to Upload, Download and Modify Files.
 
Plesk 12.x & Plesk Oynx
  1. Log in to your Control Panel.
  2. In the Home tab, under My Subscriptions select the domain you wish to manage.
  3. Click on the Websites & Domains tab.
  4. Click the Show More link
  5. Click on Virtual Directories.
  6. Select the Error Documents tab.
  7. Click on the error code you want to configure.
  8. Select URL.
  9. Provide a physical URL to the error page (for example /404.aspx).
  10. Click OK.
Plesk 11.x
  1. Log in to your Control Panel.
  2. In the Home tab, under My Subscriptions select the domain you wish to manage.
  3. Click on the Websites & Domains tab.
  4. Click the Show Advanced Operations link
  5. Click on Virtual Directories.
  6. Select the Error Documents tab.
  7. Click on the error code you want to configure.
  8. Select URL.
  9. Provide a physical URL to the error page (for example /404.aspx).
  10. Click OK.
Method Two: Configuring ASP.NET Error Pages
This option requires you to edit your web.config file. See How to Access Your Web.Config.
Technical assistance for this method is not provided.
  1. Open up your web.config file.
  2. Scroll to the area in which the CustomErrors section is specified.
  3. Update your CustomErrors node to be similar to the following:
    <customErrors mode="RemoteOnly">
          <error statusCode="404" redirect="/404.aspx"/>
    </customErrors>
The statusCode node is the status code you want to trap.  In this case, 404 is the status code for "Page Not Found", redirect is the URL you want to send users to.  In this case, it is /404.aspx (assuming this file exists).
 
Alternate Complete Solution
This solution provides an easy fix that encompasses ALL errors.
This option requires you to edit your web.config file, if you are unsure of how to do this see How to Access Your Web.Config.
Technical assistance for this method is not provided.
  1. Open up your web.config file.
  2. Scroll to the area in which the CustomErrors section is specified.
  3. Update your customErrors node to be similar to the following:
    <customErrors mode="On" defaultRedirect="/GenericError.html" />
One thing to note, is that this method will encompass ALL of your errors. What this line does, is provides a generic document for any error that is not directly specified.

Add Feedback