How to Create a Custom Database Error Page in WordPress with Free Template

John Turner founder of SeedProd Posted by John Turner on October 24, 2016

Last updated on: October 28, 2016

* Scroll down to get our Free Custom WordPress Database Connection Error Template


Default WordPress Database Connection Error Page

Have you ever visited a WordPress site or had your own site return a WordPress Database Error that says “Error Establishing A Database Connection“. This message can occur for several different reasons ranging from problems with your host to mistyped database credentials. Today I’m going to show you how to customize this message into something more useful for your visitors when they encounter this error.

The image above shows the default WordPress connection error. Wouldn’t it be great to provide your visitors with a more attract message and maybe a way for visitors to leave their email so they can be notified when your site is back up? Today I’m going to show you how to accomplish both.

How to Create a Custom WordPress Database Error Page

The good news is that creating a WordPress Custom Database Connection Error Page is as simple as uploading a file named db-error.php to the root of your wp-content folder in WordPress. (Learn how to ftp into WordPress)


The bad news is that making this page look good, unless you know HTML, and returning the correct http status code so Google does not index this error page, which can screws up your SEO, is not so simple. First of all when you create a db-error.php, WordPress will use this page and return a http status code 200, which to Google means everything is fine. If Google is crawling your site when this happens that means Google will index your error page instead of your correct home page. This is bad. So to make sure Google does not index your custom WordPress database error page you need to include this at the top of your db-error.php file.

<?php header('HTTP/1.1 500 Internal Server Error'); ?>

This will ensure your custom database error page will return the correct http status code so that search engines don’t index this page.

To make this page look good you can use custom html and css to create page and make it look any way you want. That is if you know html. If not we have repurposed our free html coming soon page template as an attractive alternate and it lets you collect email from your visitors so can notify them when your site is back up. This template uses MailChimp to collect emails but you can swap that out for and 3rd party mail provider that provides an embeddable form.

Note: Since WordPress is in error mode you will not be able to use another plugin or shortcode on your custom database error page. Just use HTML and CSS aside from the php http status code we provide above.

Free Customizable WordPress Database Connection Error Template


Get a free custom database error page template for your WordPress website to use when a database connection error occurs.

  • Features Include:
  •   Comes with 6 Background Images or Use Your Own
  •   Easily Customize the Logo, Headline and Description
  •   Collect Emails with MailChimp
  •   Display Links to Your Facebook, Twitter and Email Accounts
  •   Built with Bootstrap, HTML and CCS3
  •   Well Documented

Free Download

Want to create a more customized error page and collect email from different email providers? Checkout, this builder creates custom html coming soon pages which can be repurposed for WordPress error pages.

John Turner founder of SeedProd

By John Turner

John is the founder of and a WordPress Developer with over 15 years of development experience.

Made with in Charleston, SC USA

Copyright © 2020 SeedProd LLC
Terms & Conditions | Privacy Policy | SeedProd Coupon Code