Random developer notes

Sometimes, when you’re working on a web site, you need to make some changes that could cause problems if there is someone else using the site at the time. The obvious solution is to suspend the site — e.g. put up a ‘this site is down for maintenance’ page — but how do you do this while still being able to view and work on the site yourself?

In fact, it’s really quite easy, using .htaccess. Simply put, you use mod_rewrite to redirect all requests to the maintenance page, unless the user’s browser has a particular cookie.