Custom error pages

By default a missing page shows a bare server message. A custom error page keeps visitors on your site instead of leaving them at a dead end.

Setting them up

cPanel has an Error Pages tool for the common ones. Alternatively, put the files in your public_html and reference them in .htaccess:

ErrorDocument 404 /404.html
ErrorDocument 403 /403.html
ErrorDocument 500 /500.html

Use a path starting with a slash, not a full web address – a full URL turns the error into a redirect and the browser then reports 302 rather than 404, which confuses search engines.

What a good 404 page does

  • Says plainly that the page was not found
  • Offers a search box and links to your main sections
  • Looks like the rest of your site
  • Does not blame the visitor – the link was probably yours

The 500 page is different

Keep it plain HTML with no PHP, no database and no images from the site. If the server is erroring, anything clever will fail too and the visitor gets the bare message anyway.

Do not redirect all 404s to the home page

It is a common idea and a bad one. Visitors think the link worked and are confused about where they are, and search engines see pages that claim to exist but show something unrelated. A proper 404 is the honest answer.

Watch what is 404ing

Search Console lists them. A page appearing repeatedly usually means a broken link somewhere on your own site, which is worth fixing at the source.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to configure directory and file privacy

Password protection via .htaccess and .htpasswd It is possible to password protect an entire...

How to exclude a subfolder from password protection with htaccess file

A very useful and simple to use method of protecting access to a directory or an entire account...

Redirects: 301, 302 and how to set them up

A redirect sends a visitor from one address to another. Choosing the wrong type quietly costs you...

Common .htaccess mistakes

.htaccess is powerful and unforgiving. One wrong character takes the whole site down with a 500...