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
- Log in to your Control Panel.
- In the Home tab, under My Subscriptions select the domain you wish to manage.
- Click on the Websites & Domains tab.
- Click the Show More link
- Click on Virtual Directories.
- Select the Error Documents tab.
- Click on the error code you want to configure.
- Select URL.
- Provide a physical URL to the error page (for example /404.aspx).
- Click OK.
Plesk 11.x
- Log in to your Control Panel.
- In the Home tab, under My Subscriptions select the domain you wish to manage.
- Click on the Websites & Domains tab.
- Click the Show Advanced Operations link
- Click on Virtual Directories.
- Select the Error Documents tab.
- Click on the error code you want to configure.
- Select URL.
- Provide a physical URL to the error page (for example /404.aspx).
- 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.
- Open up your web.config file.
- Scroll to the area in which the CustomErrors section is specified.
- 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.
- Open up your web.config file.
- Scroll to the area in which the CustomErrors section is specified.
- 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.
Article ID: 185, Created: April 6, 2012 at 10:10 AM, Modified: August 20, 2019 at 12:04 PM