Skip to content →

HOWTO: Update WordPress with Minimal Downtime

All Things Marked runs on the WordPress blogging platform. Honestly, what blog doesn’t? WordPress often has updates to the code, which involves completely updating files that run the site. Many blogs need to take their sites down for a bit to deal with the update process, however, this process can be completely done within 5 minutes. I’ll give you some tips on how to systematically update WordPress while keeping a professional look to the site. Let’s get at it so you can use this method for your next update.

1. Create a “We’ll be right back” landing page

The first thing you need to do is to create a landing page for visitors to see when you are in the update process. This should be a very simple page that says something like, “[site name] is updating right now and will be back in a flash.”

I’ve created such a page at allthingsmarked.com/updatingwp.html

It’s simple and to the point. One thing that I’ve done which I recommend is to add a refresh meta tag that will refresh the site in 5 minutes. The whole update process should take 5 minutes or less, so if you auto-refresh the page for your visitor after 5 minutes, they will see the site back in action. To do this, just add the following meta tag:

<meta http-equiv="refresh" content="300;url=http://www.allthingsmarked.com" />

Obviously you need to change the domain. The 300 is the time in seconds, which means 5 minutes.

2. Create alias commands (if you have shell access)

If you have shell access to your server, SSH in and open up your aliases file. I’m not a linux guru, but I believe this file varies for each distro. My file is the .aliases file in my home folder. Open it up and add two new aliases, one to swap in the landing page, the other to revert to the original home page.

We want to rename the live site’s index to a backup of it and then rename the landing page to index. This will “take the site down” by making all requests go to this new home page. Don’t worry though, you still have the backed up live site index. At this point, you would then transfer your update files. Once your done with the update, you want to undo the renaming of files. Here are the two commands you need:

alias startwpu 'mv ~/site_path/index.php ~/site_path/index-backup.php && mv ~/site_path/updatingwp.html ~/site_path/index.html'

alias stopwpu 'mv ~/site_path/index.html ~/site_path/updatingwp.html && mv ~/site_path/index-backup.php ~/site_path/index.php'

The startwpu command you are creating will rename the real index file to another name, then it will rename the landing page to the index. The stopwpu will do the opposite: rename the index to the landing page then rename the backed up index to index.

3. Upgrade WordPress

Once you have the landing page set up and the appropriate aliases, you can update your site.

1. On the command line run the new startwpu command.
2. Transfer all of the files in the new version of WordPress EXCEPT index.php (save that till the end!)
3. Once all files except index.php are transfered, run stopwpu — this will bring back the real index.php
4. Now, transfer the new index.php from the upgrade files and it will overwrite the “old” one
5. Go to your-site.com/wp-admin/upgrade.php and finish the process
6. At this point, 5 minutes should not have passed, unless you have a slower connection

Your visitors in that 5 minutes while have the landing paging standing by to redirect them. Feel free to adjust the refresh rate based on your typical backup time length.

Published in time savers

9 Comments

  1. Good tips, especially on putting up a warning page. However, in addition to not copying the index.php file until you are ready, it is also recommended not to replace your wp-config file, and any others you may have modified or changed. This file is rarely updated and the update, if your site is international and uses foreign language support, could bork your install.

  2. Mark Mark

    Lorelle,

    I agree! I didn’t mention it though for one reason:
    WP comes with the config as wp-config-sample.php, so even if you do transfer it over, it has the extra “-sample” so it won’t overwrite your working copy. Good catch though.

  3. […] Even with my complaints, I strongly recommend WordPress. If you want to give it a spin, you can use their free, hosted, blogging service at wordpress.org. If you’re thinking of upgrading or switching check out this handy guide: How to update wordpress with minimal downtime. […]

  4. In the article a huge thank you all for the cause, a lot of people are using

  5. This is a very good stuff man. But you can be more specific next time. See ya !

  6. new homes are actually cheaper in the long run compared to renting an old house or renovating a used home ::

  7. new homes these days are made of energy efficient insulations and most of them use environment friendly materials too ”*

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.