How to make your site appear offline while it’s being built

By using this piece of .htaccess code you can redirect any visitor who is not at a selected IP address. You may use as many IP addresses or as few as you would like.

This is a very simple way to redirect visitors so they are unable to view your site. It is possible to redirect all visitors excluding yourself, co-workers, and even your clients.

  1. First, make a coming soon page named “comingsoon.html”, and then upload it to public_html.
  2. Then, add this to your .htaccess file
  3. RewriteEngine On
  4. RewriteBase /
  5. RewriteCond %{REMOTE_HOST} !^
  6. RewriteCond %{REQUEST_URI} !/comingsoon.html$
  7. RewriteRule .* /comingsoon.html [R=302,L]

Was this article helpful?