---
title: 404 best practices
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Sometimes, you’re looking for information or a product on a website and end up with an error message displayed on your screen. It’s good practice to set up an error page to help you, a lost visitor, make sense of the situation.

There can be many reasons for the error, from users misconfiguring something to internal server failures. On the backend, these are represented by error codes. The code is a standard HTTP error message code signaling there is an issue with the website you were trying to reach.

Some of the common server errors are:

- _403 Forbidden_ - You do not have permission to access this page.
- _400 Bad request_ - Your browser performed an invalid operation.
- _500 Internal server error_ - The server encountered an error while processing your request.

The best-known error is _404 Not found_, which indicates that the server couldn't find the requested webpage, PDF file, or image. A user-friendly error page clears up the confusion and guides visitors back to your content. In Xperience, developers can set up custom error pages that you create and design in the content tree. For the developer setup, see [Serve custom error pages](https://docs.kentico.com/documentation/developers-and-admins/development/routing/serve-custom-error-pages.md).

## 404 pages

The 404 page appears when a visitor wants to access a web page that doesn’t exist or has been removed. In the worst-case scenario, they land on a default blank page with a simple _“404: Page not found”_ information. The better option an error page that includes a message explaining the requested content is unavailable.

> **Info:** There could be more reasons why you end up on 404:
>
> - The page you want to visit no longer exists,
> - The page was moved to a different location without updating the link,
> - The page is not available at the moment, blocked, or restricted,
> - There was a typo in the link,
> - The file, or an image you requested is not available.

If set up properly, the 404 page helps visitors find what they’re looking for, recommends how to find it, and leaves them with a good feeling instead of wondering how to get where they want to be. The 404 page can help with user experience, keep the visitors on your website, and even help with conversions.

> **Info:** The examples in this article are from the _404_ page for the Kbank demo site.

![Kbank 404 page](https://docs.kentico.com/docsassets/modules/404-best-practices/kbank-404-page.png "Kbank 404 page")

## 404 best practices

When a visitor enters a URL that doesn't match any published content, the server responds with an error and displays the custom error page configured by your developers. Because hitting a dead end frustrates visitors, design your error page to be easy to read, deliver a clear message, and offer a quick way back to your website.

Here are some basic recommendations you can use:

### Keep it simple

Probably the most important recommendation. Nobody wants to read long essays on why they hit a dead end. Just let the visitors know you're sorry something went wrong and offer a solution. Remember, less is more.

> **Tip:** If you add a funny element like a joke, or a quiz, plus points.

![404 page explanation](https://docs.kentico.com/docsassets/modules/404-best-practices/error-page-404-part.png "404 page explanation")

### Use your branding

Style the page according to your brand style guide. The error page is still part of your website, and you want the visitors to know it. Plus, using keywords relevant to your brand (or business field) can help navigate the visitors and suggest they may wish to continue to a specific place on your website.

![404 in Kbank style](https://docs.kentico.com/docsassets/modules/404-best-practices/error-page-404.png "404 in Kbank style")

### Personalize

If you are [tracking your visitors](https://docs.kentico.com/documentation/business-users/digital-marketing/contact-groups.md) on your website and collect information about their customer journey, you can redirect them to pages most relevant to them. Xperience does this with personalization.

For example, you can offer more specific _Page heading_ to visitors interested in insurance, followed up by relevant articles.

![Page heading personalization](https://docs.kentico.com/docsassets/modules/404-best-practices/page-heading-widget.png "Page heading personalization")

### Provide search bar

A direct way to help the visitors find the intended product or, for example, an article, is to offer them a search bar. This way, they can search directly for what they were looking for.

> **Info:** A search bar widget is not available in Kbank at the moment. The example below is a search box in the website menu.

![Kbank search bar](https://docs.kentico.com/docsassets/modules/404-best-practices/search-bar.png "Kbank search bar")

### Redirect to an existing page

Another way to keep the visitor on the website is to provide links to relevant pages. It could be a _Home page_, specific product, or an info page that can answer the most common questions or help the visitor decide where to go next. In our example, the _404_ page shows the latest articles.

![Articles list](https://docs.kentico.com/docsassets/modules/404-best-practices/error-page-recent-articles.png "Articles list")

### Be approachable

You can also offer the option to contact you directly via a contact form or an email. Or, if you are active on social media, you can link them, too. If you’re building a community on social media, this could be another way how to lead people there.

![Kbank contact form](https://docs.kentico.com/docsassets/modules/404-best-practices/error-page-form.png "Kbank contact form")

## Analyze why people get to an error page and fix it

Because visitors inevitably encounter broken links or mistyped URLs, a helpful error page is always worth the effort. To reduce how often visitors land on the 404 page:

- Fix broken links and links to deleted pages.
- Regularly check and update redirects.

> **Info:** Since Xperience doesn’t have any analytics built in, you can use 3rd party tools to analyze incoming traffic, for example [Google Analytics](https://marketingplatform.google.com/about/analytics/)  or a [Google search console](https://search.google.com/search-console/about).

## Let the page work for you

Take the time to create a good error page. If done right, the error page provides a clear message, supports visitors to find what they’re looking for, and lifts their mood by helping them get back on track after they get lost—all that while the visitor gives your company plus points for taking good care of them.
