General Foch General Foch - 7 months ago 54
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>

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

</Directory>


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