Temporarily unavailable page – .htaccess configuration example

Today we are going to show you how to prepare a mod_rewrite, .htaccess file configuration for your WordPress blog that will redirect every request to the same page – the WordPress temporarily unavailable page.

ITCuties – WordPress temporarily unavailable page

It is a good practice to extend or modify your page functionality on a development environment. If you are looking the way to move your site between different environments you might find this post useful – How to migrate WordPress site from localhost to server. When the work is done and the code is well tested then it is time to move your work to the live site. It might take some time to copy files to the server so it is a good practice to make your site unavailable for the visitors during this process. This way they won’t see any bugs on your page because of the fact that not all files have been copied yet.
All you need to do is to prepare a “temporary unavailable” page, backup the WordPress .htaccess file and then modify it with this code:

.htaccess

The first line of this configuration activates the mod_rewrite engine.
In the second line the expression ^(.*)$ represents all the possible URLs which are forwarded to the temp-unavailable.html page. The [L] flag ends the rule and the [QSA] flag is used to pass through the query strings.