Redirecting visitors to an Under Construction page Updated on August 16, 2021 by InMotion Hosting Contributor 1 Minutes, 41 Seconds to Read When working on your website, you may want to prevent any visitor from accessing your site except you. This can be done by creating a 302 temporary redirect in your .htaccess file to a construction page. By creating a redirect for any IP address except your own in your .htaccess, you can prevent visitors from accessing your site while you update it. This tutorial will explain how to create a redirect for all IP addresses, except your IP, to a construction page on your server. Important! You will need to create a page in your public_html called “construction.html“. For information on how to create a page in your public_html see our article on Creating an Under Construction or Coming Soon page. Steps to allow only one IP access First, you will need to obtain your IP address. Visit the following link to obtain your IP. support.inmotionhosting.com/ipcheck.php Next, Login into your cPanel Go to the File Manager. Select the public_html web root. Important! Make sure you have the show hidden files box checked. Click Go. Edit the .htaccess file with the code editor. Paste the following code at the top of the .htaccess file. NOTE! The following code is for IP 123.45.67.89 (The code looks like !^123.45.67.89$). You will want to change the code to your IP. 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. Important! If you are pointing to a subdomain you will need to place RewriteEngine Off code in the .htaccess of the subdomains directory. Now when your site is visited, any visitor that is not from 123.45.67.89 will be redirected to the construction.php. Important! If you cannot access your website after a certain amount of time, its possible your IP address changed at your local connection. This is common with dynamic IP addresses. You can get your IP again and edit the .htaccess to reflect your new IP address to restore you access to your web site. Share this Article Related Articles How to Align and Float Images with CSS Margin vs Padding Preview Shared Content With Facebook Debugger Accessing Your Website via IP Address The Role of Blocks and Animations in WordPress Is Django supported? Using the Under Construction Page provided by InMotion Hosting Creating an Under Construction or Coming Soon page Beginner Web Design: Guides to HTML and CSS Links to the stylesheets in Responsive Templates