Creating a Custom Database Error Page for WordPress







In WordPress 2.3.2 you can now define a custom database error page. In addition to securing WordPress 2.3.2 by subduing many of the database error messages (thus divulging something about the site’s database structure) you can make it where WordPress will always display a custom error message when any database error occurs.

In the past, even ‘cannot connect to database’ errors have displayed brief bits of info relating to the structure of your site. By adding a custom database error page you can eliminate these being shown to visitors altogether.

  1. Simply create a page with your custom database error message. You can use HTML or whatever you want, but a simple text message works just fine. Something like “I’m sorry, but you seem to have encountered a database error. Please check back later or notify the webmaster”
  2. Save your file as ‘db-error.php’. Even if you’re using a text editor you can save the file with a PHP extension. In Windows notepad, for example, you would select ‘all files’ rather than ‘text’) and type in ‘db-error.php’.
  3. Upload your new custom database error file to wp-content/db-error.php of your site.

Congratulations! You’ve successfully created your own custom database error page. This file will be displayed whenever your site has trouble connecting to the database server.

Related Posts:
Wordpress 2.3.2 -Another Update?!
...COMPLETE Automated Wordpress Database Backups
...Before Installing Wordpress Plugins…
...Reducing Badwidth Usage for Your WordPress Site
...Changing The Wordpress Default Settings
...

Leave a Reply

You must be logged in to post a comment.