Paste the code below into a new file. Name it db-error.php and save it on your wp-content directory. In case of a database error, WordPress will automatically use this file.
<?php // custom WordPress database error page tutorial @ santoshkori.com header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 3600'); // 1 hour = 3600 seconds mail("mail@santoshkori.com", "Database Error", "There is a problem with teh database!", "From: SantoshKori's Blog"); ?> <!DOCTYPE HTML> <html style="height:100%;"> <head> <title>Database Error</title> <style> body { padding: 20px; background:#fff; color: #999; font-family: arial; text-align:center } </style> </head> <body style="height:100%;"> <h1>Captain, the ship can’t take much more of this!</h1> <p>SantoshKori's Blog is currently experiencing technical issues — Please check back soon!</p> <P>Mail me at <a href="mailto:mail@santoshkori.com">mail@santoshkori.com</a> <img src="http://santoshkori.com/blog/wp-content/uploads/2010/10/freelancer-webdesigner-mumbai-india.jpg" style="position:fixed; bottom:5%; right:2%;"> </body> </html>
Simple, yes, but more effective than the default error page at facilitating a rapid response. Again, because this is a regular PHP file, we can do just about anything with it — more functionality, elaborate design, etc
Here’s an example of the code you could use for this page (see the final output here):
0 Comments.