Home » Htaccess Tools » Questions regarding htaccess » How to allow by IP only?
How to allow by IP only? [message #282] Mon, 20 March 2006 01:29 Go to next message
Sentinel  is currently offline Sentinel
Messages: 4
Registered: March 2006
I searched before asking but I did not find an answer to this question.

I see where you have a way to block by IP address.

But how do I allow by IP address only? In other words I want to allow access to a certain folder on my web site only to me at from my IP address and block any one else.
How to allow by IP only? [message #288] Thu, 23 March 2006 09:32 Go to previous messageGo to next message
andreas  is currently offline andreas
Messages: 239
Registered: January 2005
Location: Denmark

Site Admin
You can use:

Order Allow,Deny
allow from ip


Just change ip to the ip address you want to allow access.

See more info at http://httpd.apache.org/docs/1.3/mod/mod_access.html
How to allow by IP only? [message #290] Thu, 23 March 2006 17:09 Go to previous messageGo to next message
Sentinel  is currently offline Sentinel
Messages: 4
Registered: March 2006
OK a few more questions just to make sure I have got it if you don't mind.

Another person told me to do this:
Order Deny,Allow
Deny from all
Allow from xx.xx.xx.xx

But according to your post you leave out the "deny from all" and your order is allow,deny not deny,allow. From the information on the link you posted it would seem that it can be done either way because ...

In the example I show above the default is to allow since that is listed last, BUT since I put the "deny from all" statement it would deny from all but allow that one specific IP address.

In your example the default is to DENY since it is listed last, so it would allow the one specific IP address but deny everyone else since the default is to deny. Therefore there is no need for the "deny from all" statement. Do I understand so far?

So you can have ...
order deny,allow
deny from all
allow from x.x.x.x
Or you can have ...
order allow,deny
allow from x.x.x.x

But is it OK to have ...
order allow,deny
deny from all
allow from x.x.x.x
Would that be wrong?
How to allow by IP only? [message #291] Thu, 23 March 2006 19:27 Go to previous messageGo to next message
andreas  is currently offline andreas
Messages: 239
Registered: January 2005
Location: Denmark

Site Admin
Yes, you got it correct.

order allow,deny
deny from all
allow from x.x.x.x


The above code is also ok to use.
How to allow by IP only? [message #294] Sat, 25 March 2006 19:22 Go to previous messageGo to next message
Sentinel  is currently offline Sentinel
Messages: 4
Registered: March 2006
andreas

Yes, you got it correct.
order allow,deny
deny from all
allow from x.x.x.x
The above code is also ok to use.
Sad But the above code does not work. It denies everyone including me.
How to allow by IP only? [message #295] Sat, 25 March 2006 20:59 Go to previous message
andreas  is currently offline andreas
Messages: 239
Registered: January 2005
Location: Denmark

Site Admin
Try

order allow,deny
allow from x.x.x.x 
deny from all
Previous Topic:web site for users in LAN
Next Topic:a quick .htpasswd questions involving linking
Goto Forum:
  


Current Time: Fri May 16 18:41:30 CEST 2008

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software