1and1 Help Centre Categories

print article

Create Custom Error Pages (MS 2008)

For Microsoft 2008 Hosting packages

Follow the steps on how to create custom error pages.

Visitors will see your individual messages or explanations instead of the default 500, 404, 403, etc. error pages.

Step 1
Create the custom error page.
Step 2
Save the custom error page.
Step 3
Upload the custom error page to your web space.
Step 4
Specify the path to the custom error page in the web.config file.
Step 5

Listed below is the path for the 404 error page in the default web.config file. You may replace this path with the path to your uploaded file so that your custom error page is used instead.

error statusCode="404" prefixLanguageFilePath="" path="/OaOInternal/DefaultWebs/sedoCurrent/Error404.aspx" responseMode="ExecuteURL" />

If your custom 404 error page is named error404.html and was uploaded to the root (top most) folder in your web space, you would list the path as /error404.html as can be seen in the sample web.config file below.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear />
<add value="index.aspx" />
<add value="index.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="home.aspx" />
<add value="home.asp" />
<add value="home.htm" />
<add value="home.html" />
<add value="default.aspx" />
<add value="default.asp" />
<add value="default.htm" />
<add value="default.html" />
</files>
</defaultDocument>
<security>
<authentication>
<basicAuthentication enabled="true" />
</authentication>
</security>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/error404.html"
responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>

Now to test, you simply need to access a non-existant page of your website which should produce a 404 error since the page will not be found. You should see your custom page loaded instead of the default page.

For additional information, you may want to reference: