Using Temporary Maintenance Page when Upgrading Wordpress
By Reaper-X on Sep 25, 2007 in Apache, Guide, Wordpress
This is the very first time i need to use a temporary server maintenance page, previously when i upgrade wordpress (even to major release such as this one) … there’s no need for me to redirect this site visitors to a temporary page saying that this server is under maintenance, but this time the situation is different
And that’s because i do not want my visitors to see lots of beautiful MySQL error message when viewing every page of this site (i’m quite sure you feel the same way too) because of the recent database schema changes in Wordpress 2.3, but … how to do that ? if you ask me …
The answer is simple, as long as you have access to edit your .htaccess file (some web hosting company doesn’t allow you to edit the .htaccess file, and that’s why i said so) :)
And here are the complete instruction :
1. Create a new html page saying that this site under maintenance or anything you like :) , and save it as maintenance.html (this is just an example, feel free to use another filename)
2. Edit your .htaccess file in your root public_html directory
and add these lines :
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.0
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteRule .* /maintenance.html [R,L]
Note : Replace 123\.456\.789\.0 with your own ip address
And here are the description about what the above line does :
- The first RewriteCond is used so that you can still access your site, by detecting your ip address
- The second RewriteCond is used so that every request to maintenance.html file will not be redirected, this is used to prevent infinite redirect loop
- The third RewriteCond is used so that others that is trying to access your site in any page will be redirected automatically to your maintenance.html page using temporary redirect so that search engine robot will check again later
3. Now you just need to upload the above file into your public_html directory and continue the upgrade process
But what if you’ve finished upgrading your wordpress, and you want your visitors will able to view your site again ?
Simple … you just need to remove the above .htaccess rules, and to make sure that your site visitors will be automatically redirected to your main page, you can add below line to your .htaccess file
Redirect 301 /maintenance.html http://www.yourdomain.com
And you’re done :)

Website RSS Feed
Stumble this post
Bookmark this post on Del.icio.us
Submit this post to Digg
Submit this post to Reddit
Print this
Trackback URL











I do love the classics.