Linux and Apache

Htaccess temporary redirect while undergoing maintenance

Developing a site and you want to have a nice temporary page for visitors? Drop in this code at the top of your .htaccess file and make your pretty 'Coming Soon' page in the root called 'offline.html'.

RewriteEngine on
RewriteCond %{HTTP_HOST} example\.co\.nz [NC]
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ http://example.co.nz/offline.html [L,R=302]