FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Home » Htaccess » Allowing Access From 1 static IP and Deny the rest

Allowing Access From 1 static IP and Deny the rest

Allowing Access From 1 static IP and Deny the rest deny access to your entire site except when you access it

Allowing Access From 1 static IP and Deny the rest

November 7th, 2006

Say you want to deny access to your entire site except when you access it. The following htaccess code does just that. Instead of a Static IP you could also use a hostname, or part of a hostname..


AuthName "Site Administration"
AuthUserFile /home/user/askapache.com/.htpasswd
AuthType basic
Require valid-user
Order deny,allow
Deny from all
Allow from 24.11.54.6
Satisfy Any

More information about this technique can be found in the htaccessElite.com Authentication Forum

Specific posts:

  1. Order, Allow, Deny
  2. Block everyone except 1 IP Address
  3. Deny based on domain name
  4. Deny a Block of IP Addresses
  5. Deny A User based on their IP address
  6. Basic authentication example

http://www.askapache.com/htaccess/allowing-access-from-1-static-ip-and-deny-the-rest.html#comments

Reader Comments

  1. Pawel ~November 10, 2008 @ 4:49 pm
    Hi, regarding the actual htaccess file, where would I save this file on my web server? Do I give the file the extension ".htaccess"? Thank you Pawel

Add Comment!

Leave a Reply

Your email address will not be published.


Google +

It's very simple - you read the protocol and write the code. -Bill Joy

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. NCSA HTTPd.
UNIX ® is a registered Trademark of The Open Group. POSIX ® is a registered Trademark of The IEEE.

Site Map | Contact Webmaster | Glossary | License and Disclaimer | Terms of Service |

↑ TOPMain