Working on sites very close to live is always tricky. Clients want to use the site unhindered, you want to check it through before it goes live. The one thing you don’t want happen is for the public to discover and access the site before it goes live.
The code below allows only grant access without authentication to a set of IP’s / domains. Any request from a domain not in this list will be asked to authenticate. Satisfy any allows the .htaccess to grant permission to anyone who meets the two key criteria. In the example you will note that google’s domains have been allowed through so as not to affect SEO too much. Replace 123.123.123.123 with your IP, or that of whoever you wish to access the site. I am yet however to find one that works for dynamic IP’s – wouldn’t that be neat
You will of course need to create a .htpasswd file. a good generator can be found at http://www.htaccesstools.com/htpasswd-generator/ along with a load of other goodies.
Bash |copy code |?













