When updating your website, you may want to block all visitors except yourself. You can do this by adding a temporary 302 redirect in your .htaccess file that sends everyone else to a construction page. This lets you work on the site privately while showing visitors a “coming soon” or “under construction” message.
Important: First create a file named construction.html in your public_html directory. (For help creating this page, see InMotion Hosting’s guide on building an Under Construction or Coming Soon page.)
Steps to Allow Access from Only One IP Address
- Find your current IP address. Visit support.inmotionhosting.com/ipcheck.php and note the IP shown.
- Log in to cPanel.
- Open File Manager
- Select the
public_htmlweb root. - Check the box for Show Hidden Files.
- Click Go.
- Select the
- Edit the
.htaccessfile using the Code Editor. - Add the following code at the very top of the
.htaccessfile (replace123.45.67.89with your actual IP address):
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123.45.67.89$
RewriteCond %{REQUEST_URI} !construction.html
RewriteRule ^(.*)$ /construction.html [R=302,L]Save the file to implement the Under Construction page.
Notes:
- If you are using a subdomain, place
RewriteEngine Offin that subdomain’s own.htaccessfile. - After saving, anyone whose IP is not the one you listed will be redirected to
/construction.html. - Dynamic IP addresses can change. If you lose access later, check your current IP again and update the rule in
.htaccess.