Forum Moderators: phranque

Message Too Old, No Replies

directory directive

Denying IP's on a certain directory

         

rubendegooijer

12:21 pm on Oct 24, 2006 (gmt 0)

10+ Year Member



Hi,

I placed the following htaccess directive in my htaccess file:

<Directory /administrator/*>
Order Allow, Deny
Deny from all
Allow from 241.234.8.1
</Directory>

The administrator directory must only be accessible from the given IP address. This htaccess file is placed in the root directory.

Directory structure:

/
/administrator

I wonder why this doesn't work....

Thnx in advance!

Greetz Ruben

TristanToxic

12:25 pm on Oct 24, 2006 (gmt 0)

10+ Year Member



I believe the <directory> can't be used in .htaccess
placing this in your httpd.conf and restarting apache should work

jdMorgan

1:20 pm on Oct 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



TristanToxic is correct - <Directory> containers can'r be used in .htaccess.

You could remove the <Directory> container, and place the remaining code into an .htaccess file in the /administrator directory itself.

Jim

rubendegooijer

1:40 pm on Oct 24, 2006 (gmt 0)

10+ Year Member



Thanks for your replies,

I placed a htaccess file in the administrator directory, as you said.

Order Allow, Deny
Deny from all
Allow from 243.148.236.64

With the preceding contents.

But this causes a internal server error.

<snip>

[edited by: jdMorgan at 2:28 pm (utc) on Oct. 24, 2006]
[edit reason] No URLs, please. See Terms of Service. [/edit]

The Contractor

2:19 pm on Oct 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<Files *>
Order Allow, Deny
Deny from all
Allow from 243.148.236.64
</Files>

jdMorgan

2:34 pm on Oct 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From the Apache mod_access [httpd.apache.org] Order documentation:

Keywords may only be separated by a comma; no whitespace is allowed between them.

Jim

rubendegooijer

2:35 pm on Oct 24, 2006 (gmt 0)

10+ Year Member



Hmm I checked my IP, and it was logged as 213.148.236.66 .

<Files *>
Order Allow,Deny
Deny from all
Allow from 213.148.236.66
</Files>

I tried this, now no error appears but I'm not allowed to access index.html. While my ip-address is equivalent to the one defined in the htaccess rule.

rubendegooijer

7:35 am on Oct 25, 2006 (gmt 0)

10+ Year Member



I fixed it, I cut out the order directive.

<Files *>
Allow from 213.148.236.66
Deny from all
</Files>