SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess password

    Hi can any one confirm if it's possible to do the following

    have a .htaccess user name and password but if the ip it comes from it automatically allows thru?

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Yep, you can do something like this:

    Code:
    #Allow website access to only certain IPs. Everyone else is prompted for a username and password.
    Order Deny,Allow
    Deny from all
    Allow from 192.168.
    Allow from 172.17.1.2
    Allow from 127.0.0.1
    AuthUserFile C:\path\to\passwords\.htpasswd
    AuthName "Test Site"
    AuthType Basic
    satisfy any
    require user testuser
    #end website allow
    If you need to use a wildcard, just leave off the octets where you want the wildcard to be.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •