Forum Moderators: phranque

Message Too Old, No Replies

Restrict directory by IP except for one subdirectory

         

burnside

3:10 pm on Sep 25, 2010 (gmt 0)

10+ Year Member



Hi, I have successfully restricted access to IP addresses outside of an IP block, but wanted to know if it was possible to allow one subdirectory access. Is it possible? I am so far using the setting below.

<Directory "/my/server/path/htdocs">
Order deny,allow
Deny from all
Allow from 155.1.1.0/24
</Directory>

jdMorgan

9:17 pm on Sep 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




<Directory "/my/server/path/htdocs">
Order deny,allow
Deny from all
Allow from 155.1.1.0/24
</Directory>
#
# Override the above less-specific-directory restriction to allow all to access files in /additional-subdirectory-path/
<Directory "/my/server/path/htdocs/additional-subdirectory-path">
Allow from all
</Directory>

[httpd.apache.org...] :
<Directory> (group 1 above) is processed in the order shortest directory component to longest. So for example, <Directory /var/web/dir> will be processed before <Directory /var/web/dir/subdir>. If multiple <Directory> sections apply to the same directory they are processed in the configuration file order.

Note that the "Order" directive from the first less-specific-directory-path context is inherited by the later more-specific context.

Jim

burnside

4:43 pm on Sep 27, 2010 (gmt 0)

10+ Year Member



Perfect. Thanks!