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 :
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 :)
Leave a response
Thanks for this!
Perfect – thank you. I had to figure this out in the absence of my developer today…and you spelled it out nicely, even for non-tech-types like myself. Thanks again.
I do love the classics.