How to Create a Great Custom 404 Error Page (with Examples)

Evan Hall, SEO Strategist

Updated 9/7/22 to include new information.

You’ve spent a lot of time making sure your website is user-friendly, has a descriptive navigation, and is organized in a way that makes sense, but what if someone makes a typo when typing in a URL? What if another website links to a page you don’t have any longer? What will the user see on your 404 error page?

What is a 404 Page?

When users request a page from an address that doesn’t exist, the server should return a 404 HTTP status code. Since HTTP status codes are typically invisible to users, servers will also show an HTML page with an error message.

If it’s a default server error page, it will be an ugly, confusing experience that is sure to drive users away:


Server error pages are pretty rough to look at, and even worse, they don’t help users navigate to the actual intended website. They are also very difficult to track with web analytics, so we usually don’t know if users ever reach our content after seeing them.

What is a Custom 404 Page?

Since default server error pages have a bad user experience, it’s best to design your own custom 404 error page that is user-friendly and explains why the content requested isn’t available. Custom 404 pages should also help users continue their session and find a relevant substitute.

For example, this eFax custom 404 error page is better than a default server page because it explains the error and gives users options to get back on track.

404 error page from

Why Custom 404 Error Pages Are Valuable

Landing on a 404 page is inconvenient for your users, but not all hope is lost. A good custom 404 page can gently break the news and keep them on the site.

Better User Experience

Default error pages that look technical can give users the impression that something serious has gone wrong or confuse them. Ideally, with a custom 404 error page, we can downgrade the user’s concern from “broken website” to “minor inconvenience” by explaining what happened.

Keep Users On Your Site

If users reach a dead end on a default error page, they will leave the website and search for something else. But with a custom 404 error page, you can give users a clear path to a new destination on your website, keeping them on your site. For instance, the eFax example from above presents users with internal site search and links to common pages that could put them back in the sales funnel.

Insights on How to Improve Website Performance

Default server error pages don’t tend to have analytics tracking tags on them. How many users see one? How many exit after landing on one? We’ll never know unless we’re able to put analytics on it. Being able to easily track the analytics of your custom 404 error pages can provide helpful insights into your website’s performance. More on this below.

How to Create a Custom 404 Error Page

Creating a valuable and user-friendly custom 404 page isn’t hard. By following the steps in this guide, you can deliver a 404 page that will help users find what they are looking for and keep them on your site longer.

Step 1: Design the Page

At the start of your design process, you need to decide how funny and creative you want your custom 404 page to be. Some organizations already have creative or fun design elements as part of their brand, and the 404 page is a great way to show that off. Canva has a great list of things you can do to make your 404 page creative and interesting.

404 error page from

Not all 404 pages need to be creative, though. Some brands are more serious, and their 404 pages can be just about getting users to where they want to go.

Either way, a good 404 page should have these features:

  • A clear statement that the page the user requested isn’t available
  • Advice to help your users correct a possible mistake in the URL
  • The main header and footer navigations
  • Links to important sections of the website
  • A search bar for the website’s internal search function

At the very least, your 404 pages should tell the user there is a problem with their request. We don’t even have to use the term “404” to do this. People who aren’t digital marketers don’t need to know about HTTP response status codes.

Step 2: Configure the Server

Nowadays, most content management systems have a built-in feature for 404 error pages, but not always. If your infrastructure doesn’t support them out of the box, then you’ll need your developer to configure the server for it. Here are technical instructions for common web servers if you need to do it yourself:

If you have to configure your webserver to show custom error page content, an easy way to generate HTML for the error page is by copying the source code of a regular website page. Change the main content section to show the error message, and your 404 error page will match the rest of the site pretty well.

If your website is developed as an application with frameworks like ReactJS, Angular, or Ruby on Rails, you’ll need the routing part of the application. These approaches tend to look like creating a catch-all route that sends users to a 404 page component.

While doing research for this post, I found this novel idea for recommending the most likely correction of a non-existent URL. If your infrastructure is capable of this type of feature, definitely add it to your error page.

Step 3: Test Your Configuration

However your infrastructure is configured, there are a few best practices we must have in place for a proper 404 error page.

Confirm a 404 HTTP Response Code

Displaying the missing content message and returning a 200 status code (the normal response given for a working web page) will confuse crawlers, and you will receive soft 404 errors in search consoles. Search engines will treat soft 404s like regular ones and will count against you for ranking.

Test to see which status code you’re returning with a crawler like ScreamingFrog, or an HTTP status code checker by inputting a bogus URL like “”


Give the Error Page a Descriptive Title Tag

Page titles are visible in browser tabs and available to users using assistive technology like screen readers. We want to make sure that our error message is accessible and clear to everyone. Giving the error page a unique and descriptive title tag will also help us with web analytics down the line.

Put Web Analytics on the Error Page

We’ll want to see how often users encounter a 404 page and where they go after landing on one, so make sure the page has the same web analytics or tag management container as the rest of the site.

Step 4: Track 404 Sessions in Google Analytics

Paradoxically, we don’t want users landing on our 404 error pages, but we want to monitor that traffic when they do. We want to know how well our error page succeeds in recovering the user’s session and guides them toward helpful content.

We also want to know which URLs are broken so we can fix something that changed with our website or redirect the 404 URL to something relevant. Luckily, if we follow best practices, it’s easy to see how our lost users are doing in Google Analytics.

See Which URLs Return 404

Create a segment to only show pages that use the title tag of your custom 404 page:


Then go to Behavior > Site Content > All Pages to see the pageview report of the 404 error pages:


Here we see users are still navigating to some posts we removed in a content cleanup project. We’ll need to create redirects for these to solve the problem, but how is our 404 page performing after people see it?

To answer that question we’ll need to take a look at the navigation summary report for one of these pages:

A screenshot of a navigation summary report

Only 26% of users are exiting the site after seeing a 404 error message on this page. Not great, not terrible.

See Which Pages are Sending Traffic

If we want to see which other domains are sending users to our 404 pages, we can add Full Referrer as a secondary dimension to the pageview report:


Broken backlink reports should give us most of these pages over time, but the backlink reporting services are limited to how quickly they can crawl the web. If we have a time-sensitive need to know which other pages are sending users who are at risk of exiting our site, this report gives us that.

Common Mistakes to Avoid With Custom 404 Pages

We perform technical SEO audits for a lot of sites at Portent, and here are some of the most common problems we run into while writing recommendations for our clients.

Don’t Redirect to an Error Page URL

Make sure your website is just displaying the content of the error page and not redirecting the user to a URL like /404 or /error.html. Redirecting will prevent users from examining the problem URL, and it won’t send useful information to your web analytics.

Don’t Redirect to the Homepage

Sending all users to the homepage instead of letting them see an error may seem like a clever solution, but search engines don’t appreciate it and will treat instances as soft 404s. Redirecting users to the homepage for individual URLs when the homepage is the next most relevant page is totally fine, but a blanket redirect to the home is not.

Don’t Use a Meta Refresh Tag Redirect

I’ve seen some websites use a meta refresh tag to send users somewhere else after being on an error message page for a few seconds. Don’t do this. Navigating a user off of a page without their consent is usually a bad practice. Rarely have I seen anyone use this type of redirect well.

Creative Custom 404 Page Examples

Here are some examples of custom 404 pages I think perform their task pretty well while adding something extra to a negative experience. Consider them as a small swipe file for your designers to take inspiration from.


Dribbble is doing a lot of things right with this custom 404 error page. It’s colorful, interactive, clear about unavailable content, and provides a search bar for their internal search. The slider changes the color of the “404” by changing the images that make up the numbers to match the color. Each of the images links to users’ creative work, which is a great way to get users back on to content that is core to the website.

A screenshot of a custom 404 page from
Custom 404 example from Dribbble


404 pages don’t have to be overly creative, especially if it isn’t part of the brand. NPR presents a very usable 404 page with a clever twist to get users back on track to reading their articles by linking content about lost people, places, and things.

A screenshot of a custom 404 page from
Custom 404 example from NPR


Tripadvisor’s 404 page is a great example of being creative while staying on task. They feature an animated suitcase to keep users engaged while they read the error message.

A screenshot of a custom 404 page from
Custom 404 example from Tripadvisor


In this 404 example, I wish Ahrefs included their main navigation, but going with a call-to-action (CTA) to try their software that includes a clever inversion (what if your website has the same problem?) is pretty good.

A screenshot of a custom 404 page from Ahrefs
Custom 404 example from Ahrefs

Link Rot is Real and That’s Okay

The web is not static. Pages are constantly being created and deleted, and the links between those pages break and disappear every day. This phenomenon is called “Link Rot,” and it’s perfectly natural.

Our links are going to break over time. As SEOs, web managers, and good citizens of the web, we should be making sure users are able to navigate through link rot smoothly. And the first line of defense is a custom 404 page.

Start call to action

See how Portent can help you own your piece of the web.

End call to action


  1. I would recommend that all 404 pages have these things.
    * A search form so that the user can search your site for what they were looking for.
    * A contact form so that they can ask for help if the error persists.
    * A little self-deprecating humor regarding the error. I’ve seen some really funny ones in the past from companies that you wouldn’t think have a sense of humor.

  2. I completely agree – when I worked at Amazon, I remember users loved the little doggie that appeared on 404 pages. I also agree with Chris re: self-deprecating humor – it makes your company more memorable.

  3. great post.. and yes.. after having done over 500 websites.. it’s still not used… it should be the first thing after site redesign is completed.
    like as part of posting the new site.

  4. dave – yea you have to do that with mod_rewrite – which can get complicated but do some research on google about it. There is also a new service from google webmaster – 404’s that generates links on your 404 pages for related urls in your domain users may have wanted to go to. You can use to check to make sure your http status codes are setup right for 404 pages too

  5. 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 🙂

  6. I’m using 1and1 as my domain keeper and host.
    my .htaccess file reads:
    ErrorDocument 404 /404.php
    and that is it (am I missing something?)
    the 404.php file exist. and they are both on the server, but I still received the same default error.
    This is supposed to be a broken… and yes it’s long.
    SEOT: mBcWbn6FEsRp3EnIXe3G

  7. Using your advice, I built a notfound.html file about a year ago.
    I update it whenever I see a bad link that I can’t get the referer to fix, by listing the correct link on the page.
    But I can’t find a way to track the activity that it sees and whether or not my approach is effective.. I’d like to know how often a request actually gets there and where it goes from there. like GA Navigation stuff like Landing page and Next pages.
    notfound.html doesn’t show up anywhere on GA or in Cpanel that I can find.
    Any ideas?

  8. Is there any option so that if 404 Error occurred it get redirect to any fixed page in PHP site using htaccess redirect?

    1. Hi Satta,

      It’s possible to redirect URLs you know are going to return 404 otherwise, but you’ll need to create redirect rules for those instead of using ErrorDocument. Dreamhost has a good guide to the types of redirects you might want to use:

      One thing we don’t recommend is redirecting every missing page to the homepage instead of returning a 404 message. That’s an instance of a “soft 404” and it’s not helpful to users or search engines. If you want to redirect users to other content instead of showing an error message, help users by sending them to the next best piece of content to answer their query.

Comments are closed.

Close search overlay