General Foch General Foch - 3 years ago 243
Apache Configuration Question

httpd block access for all file types in a directory but allow access to a single file.

inside my site i have a directory /here/is/the/dir/path

i want to allow access to a single file in a subdirectory
example: test/testfile.xml
but want to deny access to a list of other files (jsp, class, jar, xml )

i have this which i want to place in httpd.conf

<Directory /here/is/the/dir/path >

<FilesMatch "test.xml">
Order Allow,Deny
Allow from All
Deny from None

<FilesMatch "+\.(jsp|class|jar|xml)">
order allow,deny
deny from all


is this the correct way to write this? is there a way to combine my two file match statements into a single statement ?

Answer Source

the stated method has been tested and is working.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download