.htaccess Under Construction

Maybe your site needs to undergo maintenance, or you want to put up a placeholder page while you build a new website. Whatever the reason here is a great way to implement it using your web server’s .htaccess file.

First you should create your temporary page. Make note of any outside images or files that you link to as you will need to add an exception for them later. Finally modify and merge the following code into your root directories .htaccess file. Replace the X’s with your IP address and include any auxiliary files you may need.


# Turn on mod_rewrite
RewriteEngine On
# If not your IP address
RewriteCond %{REMOTE_ADDR} !^XX\.XX\.XX\.XX
# and not the temporary page and logo
RewriteCond %{REQUEST_URI} !^/construction\.
RewriteCond %{REQUEST_URI} !^/images/logo.gif
# redirect to under construction
RewriteRule /*$ /construction.html [L]

Leave a Reply

Your email address will not be published. Required fields are marked *