Need to do some development work on a website or CMS and want to work on it in the root directory while the old site continues to function?

  1. Create a new directory in the public_html folder and transfer the old website pages into it.
  2. Next (if it doesn't already exist) create a text file named .htaccess and paste in the below code and edit in your own IP addresses, domain name and the directory name (where your old site sits) and upload via FTP into your public_html folder:
RewriteEngine On
RewriteCond %{REMOTE_HOST} !^50\.104\.245.177
RewriteCond %{REMOTE_HOST} !^78\.517\.456.812
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/oldsite/
RewriteRule ^(.*)$ /oldsite/.

(You can delete line 3 if you don't need a second IP address, or just add additional lines of other IPs as needed.)

  1. Now test your site and make sure all the public traffic clicking on your links is being redirected properly into the oldsite directory (or wherever your old site sits), while your own IP address is being allowed access to the root directory where you can now start uploading and working on your new CMS or website. NOTE: You may need to edit your .htaccess file occasionally if your ISP dynamically serves you your IP address.
  2. After your new CMS or website is fully developed, tested and ready to go live, just remove or comment out the script from the .htaccess file and let traffic access your new CMS/website. You can either keep the oldsite folder as a backup or delete it completely once the new website is running smoothly.