Forum Moderators: phranque

Message Too Old, No Replies

allow trusted ip without password but rest of all require password

         

samu12

4:37 am on Mar 11, 2008 (gmt 0)

10+ Year Member



I would like to convince three IP address to apache that if user try to see my web with that ip then it should allow without password prompt but rest of all require password prompt. Strugglin on it and spent day long but no joy on it. Please share your views.

I used this htaccess..
This htaccess works perfectly to my localhost but when i use this same htaccess another server where i have to place it, is not working(I mean, From allow ip also, it asks username and password)

AuthUserFile /Applications/MAMP/htdocs/test/.htpasswd
AuthType Basic
AuthName "test"

<LIMIT GET POST>

require valid-user
order deny,allow
deny from all
allow from 222.123.1.255
allow from 222.123.1.207
allow from 222.123.1.208

Satisfy Any

</LIMIT>

It/s an urgent...

Thank you all for your kind help

Samu

jdMorgan

3:11 pm on Mar 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why do you want to limit access for GET and POST, but leave it completely-open for PUT and DELETE, and all the other HTTP methods? This is not good.

If this code works on one server, but not another, the problem is likely that AllowOverride is configured differently on the two servers. You'll need to contact the host (where the code does not work) and ask them to change the server config to allow use of these directives. If they won't change it for you, then you'll need to change hosts.

Jim

samu12

4:03 am on Mar 12, 2008 (gmt 0)

10+ Year Member



Greetings!
First thank you so much for prompt response and kind help.
I am learner in htaccess. Just found in GET and POST in Forum and have tired that.

- Just Found a main Problem..

a.) From the server where i have to place the htaccess, From there it's working(authenticate correctly) as I browse by placing ip
eg http://125.***.1.201/myfolder/
while browse this way, it does work correctly. trust the allowed ip and require no password but rest require user name and password.

b.) But If Browse by(this is actually redirect url of 125.***.1.201) http://npl.example.com/myfolder/ then this does not trust the allowed ip from htaccess. It asks password and username.

c.) I have checked my Apache

Apache Version Apache/1.3.33 PHP/5.2.1
Hostname:Port npl.example.com:80
HTTP_HOST 125.***.1.201
REDIRECT_SCRIPT_URI http://npl.example.com
SERVER_ADDR 125.***.1.201
SERVER_NAME npl.example.com
SERVER_PORT 80

d.) So I can browse by both way, but for public, I need to use url http://npl.example.com/myfolder/

Your kind help would be greatly appreciated.
Hoping to get solution
Samu

[edited by: jdMorgan at 2:37 pm (utc) on Mar. 12, 2008]
[edit reason] Obscured specifics per TOS -- and for your security. [/edit]