I’ve been asked many times how to limit website access by allowable IP’s. This is fairly simple to accomplish with .htaccess and very useful for blocking web vagrants to allowing you to make updates to a website while redirecting all other IP’s to a maintenance page. Simply follow the steps below:
- Create a file and name it .htaccess.
- Add The following to the file:
123order deny,allowdeny from allallow from 255.255.255.255
- Replace 255.255.255.255 with you IP address. (If you don’t know it, you can get it here: WhatsMyIP)
- Once the file is created, put it in the root directory. That’s it!