+ Reply to Thread
Results 1 to 10 of 10
Like Tree2Likes
  • 1 Post By Zubair
  • 1 Post By josh72

Thread: Custom page for when wordpress is down

  1. #1
    josh72 is offline x10Hosting Member josh72 is an unknown quantity at this point
    Join Date
    Dec 2009
    Posts
    42

    Custom page for when wordpress is down

    Hey, anyone out there who uses wordpress for their site
    Due to the updates going on here at x10 my wordpress blog is down
    it comes up with a "Error establishing a database connection" page
    I'm just wondering if i could either make a new page or modify that page, so that if i get visitors whenever the blog is down, ill be able to give them some custom info and maybe redirect them
    Any help appreciated

  2. #2
    Zubair's Avatar
    Zubair is offline x10 Super Spammer Zubair has a reputation beyond reputeZubair has a reputation beyond reputeZubair has a reputation beyond repute
    Join Date
    Jul 2009
    Location
    Pakistan
    Posts
    8,747

    Re: Custom page for when wordpress is down

    Create a index.html file in wordpress root folder, design a simple page for news about the website.
    Now you will get this custom page instead of wordpress when you will open your website. If you want to put wordpress back online, just remove or rename index.html file.
    karimirt47 likes this.
    Zubair Barkat | Level 2 Tech
    █ 888-X10-9668 - zubair[@]x10hosting.com
    x10Hosting - Giving Away Hosting Since 2004

  3. #3
    josh72 is offline x10Hosting Member josh72 is an unknown quantity at this point
    Join Date
    Dec 2009
    Posts
    42

    Re: Custom page for when wordpress is down

    thanks for the info, but im looking for something more automatic
    i'd like that page to come up only when the wordpress blog is down

  4. #4
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: Custom page for when wordpress is down

    The simplest way would be to create a page, similar to what Zubair suggested but not named index.html but instead named something like offline.html. You would then need to look inside your Wordpress install and find the PHP code that checks the database connection and alter it so that when an error occurs it will redirect to the offline.html page using the header() function. This is how I do it on my site, although with a few differences as the error page is loaded in rather than redirected. Be aware that you will have to redo all the changes every time you updates Wordpress.
    Otherwise, there is probably a plugin around that does what you want.
    Last edited by lemon-tree; 06-11-2010 at 06:24 AM.

  5. #5
    josh72 is offline x10Hosting Member josh72 is an unknown quantity at this point
    Join Date
    Dec 2009
    Posts
    42

    Re: Custom page for when wordpress is down

    thanks

  6. #6
    dlukin is offline x10 Lieutenant dlukin is on a distinguished road
    Join Date
    Oct 2009
    Posts
    427

    Re: Custom page for when wordpress is down

    From wp-includes/functions.php in WordPress
    * Load custom DB error or display WordPress DB error.
    *
    * If a file exists in the wp-content directory named db-error.php, then it will
    * be loaded instead of displaying the WordPress DB error. If it is not found,
    * then the WordPress DB error will be displayed instead.
    *
    * The WordPress DB error sets the HTTP status header to 500 to try to prevent
    * search engines from caching the message. Custom DB messages should do the
    * same.
    ie, create a page db-error.php and put it in wp-content directory. It can do anything that a normal php page would do. But remember not to call MySQL

  7. #7
    josh72 is offline x10Hosting Member josh72 is an unknown quantity at this point
    Join Date
    Dec 2009
    Posts
    42

    Re: Custom page for when wordpress is down

    Thanks people i finally got it working
    I ended up modifying some code in the functions.php file
    I found the section of the file which had the code which displayed the 'Error establishing a database connection' message when a person viewed the page
    I then changed that to my own personal message with a hyperlink included to redirect visitors to a backup html page

  8. #8
    fretwizz is offline x10Hosting Member fretwizz is an unknown quantity at this point
    Join Date
    Jun 2008
    Posts
    57

    Re: Custom page for when wordpress is down

    Could you detail what you did a bit better (show the pertinent code, maybe)?

    Thanks

  9. #9
    josh72 is offline x10Hosting Member josh72 is an unknown quantity at this point
    Join Date
    Dec 2009
    Posts
    42

    Re: Custom page for when wordpress is down

    I went into the functions.php file with Notepad++
    Then i searched for: 'Error establishing a database connection'
    Theres only one instance in the file where that text is
    I just changed that line to display my own custom message with a link to a plain html page

    </head>
    <body>
    <h1>Error establishing a database connection</h1> <------------------Change this to your message
    </body>
    </html>
    <?php
    die();
    dinomirt96 likes this.

  10. #10
    figment_girl71 is offline x10Hosting Member figment_girl71 is an unknown quantity at this point
    Join Date
    Jul 2010
    Posts
    3

    Talking Re: Custom page for when wordpress is down

    Glad to have found this post! I was wondering the same thing myself. Thank you.

+ Reply to Thread

Similar Threads

  1. Custom 404 page.
    By istore_admin in forum Free Hosting
    Replies: 6
    Last Post: 04-22-2010, 06:54 PM
  2. how to custom 404 error page ??
    By mycari in forum Free Hosting
    Replies: 1
    Last Post: 10-03-2008, 11:29 AM
  3. Custom Page in Phpbb
    By ryansenara in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 12-10-2007, 08:33 PM
  4. Custom 404 page
    By panos95 in forum Free Hosting
    Replies: 3
    Last Post: 09-29-2007, 09:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers