Controlling access to your domain
Posted on 07. Jun, 2009 by Nikhil Sheth in Apache, Knowledge
You come across situation where you want to restrict access to your domain or some folder in your domain.
You may want to give access to select few IP’s only. For example, you are developing a site for your client and the site is still under construction. You would not like to open up your under development pages to the world yet but at the same time you would like to see pages as well open up for pages for your client. This can be done with ease for sites running on apache. All you have to do is add few lines in your .htaccess file.
ErrorDocument 403 http://www.youroldsite.com Order deny,allow Deny from all Allow from 59.12.43.123 Allow from 67.24.10.203
The above piece of text in your .htaccess file will allow visitors with IP 59.12.43.123 or 67.24.10.203, to see new pages. While rest of the visitors are redirected to old site.
Related posts:

Leave a reply