How to Configure a Custom 404 Error Page in Microsoft IIS Server

404 error served on a plate.

The 404 error page is a generic, browser-issued webpage that tells a visitor when a page they are looking for can’t be found. A custom 404 error page, on the other hand, is a specially designed page that delivers the same message but in a more helpful, user-friendly way.

It can tell the visitor what’s going on and what to do next. It can even help save a sale.

This post walks through the steps of how to add an IIS custom error 404 page if you’re a small business administering your own Microsoft IIS server either directly or through a hosting provider. In this post:

How to Identify Your Web Server

Custom 404 Error Page
Photo by Marc Dubois (CC by ND-2.0)

There are several popular (and many more besides) software programs used to store and host webpages, called servers. If you’re not sure which server you use, contact your web host and they’ll tell you.

If they say Apache — and it very well might be since it’s one of the most widely used servers on the web — leave this post and read How to Configure a Custom 404 Error Page — Apache Server Edition.

Not using Apache? There’s a high chance you’re using another very popular server, Microsoft IIS. Another way to tell that you’re using Microsoft IIS is if your website is programmed in .NET or another Microsoft stack, such as ASP.

So you’re using Microsoft IIS? Let’s begin.

Putting in place a custom 404 error page in Microsoft IIS takes four steps:

  1. Design a custom 404 error page.
  2. Put it in the root directory of IIS.
  3. Edit your Microsoft IIS server properties to deliver your custom error page.
  4. Test the page.


This post skips to Step 3. We assume you’ve already created a branded, custom 404 error page. We also assume you’ve put this page in the appropriate directory so that IIS has it available to serve. If that’s correct, then you’re in the right guide.

If you’d like a primer on how to do the first step, visit How to Design a 404 Error Page That Saves a Sale.

A Possible Microsoft IIS Complication

Before diving into the process, it’s important to note a potential complication regarding your IIS web server. If your website resides on a dedicated server (one that isn’t shared), you’re good to go with the steps below.

If your website lives on a shared server run by a third-party hosting provider, only the administrator is allowed to make changes to your server files. In other words, you will have to contact the hosting provider before you can gain access to the server and implement the changes outlined below. Unfortunately, this might take a while – but hopefully it’s a brief setback.

Another way to get administrative rights back in your power if you’re on a shared IIS server is to install an ISAPI_Rewrite plug-in into IIS. ISAPI stands for Internet Server Application Program Interface, and you can easily purchase this software from several places. Helicon Tech (www.isapirewrite.com) creates a good version of the software.

Ready to go? Here’s how to tell your server to replace a generic 404 error with your new and improved page.

How to Program Microsoft IIS to Deliver Your Custom Error Page

With administrative rights to make changes to your server files, you can now get in and make the changes. Exactly how to make those changes depends on the version of the software that you’re using.

Here’s a brief guide for IIS 8.5 followed by another set of instructions for IIS 10.0.

How to Prepare Custom 404 Error Pages in IIS 8.5

Step 1: Open the “Internet Information Services (IIS) Manager” tab. This is located on the Task Bar below “Server Manager,” and then underneath “Tools.”

Step 2: Identify website or application. Go to the “Connections” pane and click the plus sign (+) next to your server name to expand it. Then expand “Sites.” Next, find the site or application you want to set a custom error page for.

Step 3: Open “Error Pages.” You can do this by double-clicking “Error Pages,” located in the home pane.

Error page screenshot

Step 5: Enter the HTTP “Status Code.” When you see the dialog box “Add Custom Error Page,” enter “404” underneath “Status Code.”

Step 6: Select “Execute a URL on this site,” located in the same dialog box. This allows you to serve dynamic content, such as an asp file for the custom error page you’ve created.

Step 7: Enter the URL. Within the text box, “File path,” type the URL of the custom error page, and then click “OK.” Note: Make sure when selecting this option that the path is a relative path.

Add Custom Error Page Screenshot

Once you hit “OK,” your custom 404 error page should be live and doing its job.

How to Prepare Custom 404 Error Pages in IIS 10

Step 1: Open the “Internet Information Services (IIS) Manager” tab. This is located on the Task Bar below “Server Manager,” and then underneath “Tools.”

Step 2: Identify website or application. Go to the “Connections” pane and click the plus sign (+) next to your server name to expand it. Then expand “Sites.” Next, go to the site or application you want to set a custom error page for.

Step 3: Open Error Pages. Double-click the “Error Pages” icon located in the home pane; click “Edit.”

Step 4: Enter the HTTP Status Code. When you see the dialog box “Edit Custom Error Page,” enter “404” underneath “Status Code.”

Step 6: Select “Execute a URL on this Site.” In the same dialog box, select “Execute a URL on this site” so that you can serve your custom page.

Step 7: Enter the URL. Within the text box “URL (relative to the site root),” type the URL of the custom error page and then click “OK.”

Step 8: Select “Edit Feature Settings.” Once you hit “OK,” right-click on the 404 error and select “Edit Feature Settings.”

Step 9: Choose “Custom Error Page,” and then click “OK.” After you click this last OK, your new page should be live and ready.

Test Your New and Improved Custom 404 Error Page

Whether you’re using IIS version 8.5 or 10.0, it’s time to check if your new page is working properly. The easiest way to test your new page is to visit a bogus page on your website. Go to your web browser and type in a fake page on the site, such as www.mywebsite.com/bogus-cheeseburgers.

If the new custom page comes up, congratulations! You’ve properly set up a custom 404 error page for the Microsoft IIS server.

If you’re still getting the generic 404 error page, it’s time to check a common problem and try again.

Troubleshooting in IIS 8.5 and 10.0

  • Did you use an absolute path instead of a relative path? It has to be a relative path. This is a common issue that plagues both IIS 8.5 and 10.0. To fix this issue, simply go back to Step 6 and add a relative path. And test again. Hopefully this time you’ll find your custom page live and ready.
  • Are you not seeing the admin menus described here? It may be that you don’t have administrative access. If for some reason you cannot get admin access, there is an alternative: you can configure your custom 404 page manually by editing the Web.config file or putting it in code. Here’s where Microsoft offers steps on how to do both.

Note: If your website is programmed in something other than C#, VB.NET, JavaScript or VBScript, you can still use the steps outlined above, but you’ll have to learn how to do it depending on your programming language/framework.

Simple Change, Big Results

No one enjoys getting a bite of something they don’t want. From a visitor’s point of view, coming across a 404 error page on your website is disappointing and confusing.

And depending on what they get instead of what they wanted, a visitor can lose their appetite. In fact, it’s not uncommon for a consumer who encounters a 404 error page to immediately click the back button and exit the site completely.

A sad ending to a potential conversion.

The good news is that a custom error 404 can save the day.

While it might not be the main course that your visitors are craving, a custom error page can serve as the amuse-bouche that opens their appetites and leads them to the final entrée.

Help your hungry visitors get over the disappointment of reaching a generic error by creating and setting up a custom 404 page.

Adding a custom 404 error page is just one of the best practices in SEO. There’s so much more to learn, and you can do just that through our official Bruce Clay SEO Training course. 

Melanie Saxe was a senior content writer for Bruce Clay Inc. She holds a B.A. degree in journalism and has many years of experience crafting content for the web. When she's not writing at work, she’s usually playing Legos with her son, tinkering with her poems, or singing jazzy songs.

See Melanie's author page for links to connect on social media.

Comments (9)
Filed under: SEO
Still on the hunt for actionable tips and insights? Each of these recent SEO posts is better than the last!

9 Replies to “How to Configure a Custom 404 Error Page in Microsoft IIS Server”

First of all, Your blog on the 404 error page is very amazing. It help me a lot in my work. Keep it up and Thank you very much for it.

Jan

this works fine as long as you don’t have the ‘.aspx’ filetype at the end of the url. How do you overcome that one?

Seems like a bit technical process. But anyway it was nice to gain information about setting up a custom 404 page on the Microsoft server.

Hee Soo

Hi, I am on IIS8.5, and when I do this the header response is first giving me giving me a 200 OK and 404 Error. so the 404 part is great but the 200 OK is causing Google to see this as a SOFT 404 error. Any suggestions?

Paula Allen

Hee Soo: Since it’s not possible to get two different Status Codes in one response, perhaps what you’re seeing is that the page is returning the 404 page correctly, but with a 200 Status response. In that case, there could be a problem with your application overriding the IIS Setting (and this could take lots of different forms), the status code in the IIS setting being incorrect (such as if you used specific 404 code like 404.2 instead of just 404), or there could be another setting that is incorrect. We hope that helps!

There are several issues with this post. First, my replies are not being published for some reason, and nobody even bothers to get back to me. Second, the Server.GetLastError() object returns no data, when using IIS 10. And finally, there is no mention on how to avoid the error pages from being accessed directly by clients on the Internet.

Paula Allen

Bjorgen: Thanks for contacting us. To prevent the custom 404 error page from being indexed in search engines, the page should have a meta robots=”noindex” instruction. As for being “accessed directly by clients,” the page is meant to be seen by anyone attempting to access a nonexistent URL. As for your server question, I will check with our technical team and update this comment.

UPDATE: Our procedure in this post does not mention using “Server.GetLastError()” at all. Per our technical team, there are lots of reasons why that function may return no data.

Awesome stuff, thanks Melanie!

Great post is right – Thank you very much! I agree it should be contained within many sites. As I am re-designing a site now I was thinking a humorous and customized 404 page would be a great idea. Not only does this site show me how to do that but it gave me even more! I love the other ideas people had to add to a 404 page – like a search feature and form!! What a great idea and so simple. Thanks much again and good luck with your futures and web designs

LEAVE A REPLY

Your email address will not be published. Required fields are marked *

Serving North America based in the Los Angeles Metropolitan Area
Bruce Clay, Inc. | PO Box 1338 | Moorpark CA, 93020
Voice: 1-805-517-1900 | Toll Free: 1-866-517-1900 | Fax: 1-805-517-1919