.htaccess – Limit website access by IP

I’ve been asked many times how to limit website access by allowable IP’s. This is fairly simple to accomplish with .htaccess. Simply follow the steps below:

  1. Create a file and name it .htaccess. Paste the code into it. Replace 255.255.255.255 with you IP address. (If you don’t know it, you can get it here: WhatsMyIP)
  2. order deny,allow
    deny from all
    allow from 255.255.255.255 
    
  3. Once the file is created, put it in the root directory. That’s it!

Tags: ,

One Response to “.htaccess – Limit website access by IP”

  1. Chirs Belcore

    Exactly what I needed thanks.

Leave a Reply