The bad boy in action.
When you’re managing a homepage for a while, there will be the times when you absolutely need to take your site down for maintenance – be it a hardware upgrade, code upgrade (When migrating to a new version of your/someone elses software.) or disk maintenance due to power loss or crash. But what do you show your users while the regular homepage is unavailable? Simply shutting down the server resulting in an error for the end-user is kind of boring, and gives a far less memorable expression than having a proper downtime page, all the big boys are doing it, so why shouldn’t you?
I spent a few minutes and hacked together a minimalistic “downtime kit”.
The easiest way is to temporarily redirect your page somewhere else (where you host the downtime kit) during the downtime, and there’s a multitude of ways to do so, all depending on the architecture of your hosting setup, so you’ll have to think of the best way for you to utilize this kit.
As for how it works, it simply uses the mod_rewrite functionality in Apache to redirect image requests to one central image, so that any hotlinked images you might have show a proper downtime dialogue on their respective pages. It also redirects users who want to download files and visit pages to a proper downtime dialogue.
Setting the kit up to work for your page takes less than a minute, here are what needs to be done (taken from the readme.txt file in the distribution.)
- PHP5 (Should work with PHP4)
- Apache with mod_rewrite (XAMPP Lite distributions work great for this purpose.)
This kit is released as beerware, a very permissive license, so do whatever you please with the code.
zip file – (Mirror 1 / Mirror 2)
1.) Upload all the files into the root of your web directory, if you want to restrict the script to a subfolder, read step 2, otherwise skip to 3.
2.) If you uploaded the distribution into a subfolder (like http://www.mypage.com/ahomepage) instead of the root (which in this case would be http://www.mypage.com) – open the .htaccess in a text editor and change the second line from:
ErrorDocument 404 /index.php
ErrorDocument 404 /<your subdirectoryhere>/index.php
In our previous example, this line would be:
ErrorDocument 404 /ahomepage/index.php
If you have vhosts that link a subfolder to a domain name (ie you can visit the page at ahomepage.mypage.com) this step is not necessary.
3.) Open config.php in a text editor and change the text
<b>Status:</b><br>This page is down!
…to whatever you wish for your downtime page to show.
4.) Optionally change the notfound.jpg image for another one that suits you or your homepage better.
In other news…
Cover art for “The Constants – The Foundation, The Machine, The Ascension”
In this episode of “In other news…” we’re going to talk about post-rock. It feels like such a huge topic, but I’ll just satisfy myself by saying it’s a fantastic genre of music, especially instrumental post-rock, so without further ado, here is a list of some of my favourite post-rock band, in unspecified order – click on the band names to visit their homepages/profiles.
Most of these bands are relatively small, and you can find a lot of music on their respective Myspace profiles and homepages.