Htaccess allow deny probs


I’m having trouble with access control using .htaccess files, I’m trying to use the following code:

order deny, allow
deny from all
allow from 123.123.12/121
allow from
allow from

(IP Numbers changed)

this causes error 500 when trying to access the protected directory. Other .htaccess files I have written work correctly, but I can’t get the allow\deny code working. What am I missing?

Any help will be greatly apreciated,

Cheers for the reply.

I read though both of the linked pages you provided and tried making a few changes, but still no luck.

The files are created with notepad (no word wrap) and uploaded as a txt file in ascii mode before being renamed. The chmod setting is 644. I even tried it with just my own IP address allowed and the with just the first two lines (order, and deny all) throws up error 500 every time. I’ve had no problems with other commands (custom error docs, Dir indexing off, redirect and addtype).


I added limit tags(I’m sure I read that they’re not required) and all seems to be well. Thanks for your help.


allow from 123.123.12/121 allow from allow from numbers after the slash must be a netmask. The netmask can be the number of bits or a quad:

bits = = net is 192.168..
quad = = net is 192.168..

Also, if you get 500 errors, there will be a log entry in your Apache error.log file that should explain why the error occured.

:cool: Perl / MySQL / HTML+CSS

!!! why didn’t I think of the error log? also didn’t realise how the ip ranging worked. Cheers :slight_smile: