I recently had to move a website to a new server. While the DNS changes rolled over, I didnt want people to be able to access the site on the old server as I had already taken a backup and didnt want any more changes to be made.
I used a .htaccess file to redirect any request on the old site to a maintenance page:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance\.php$
RewriteRule ^(.*)$ /maintenance.php [R=307,L]
The above code redirects everything except the maintenance.php page to the maintenance.php page.
Its very useful to use scripts like this even when performing general maintenance on your site. You could get even trickier by allowing your IP address to access the site while still blocking everyone else. That way you can make sure your updates are working properly before ‘turning the site back on’.