I would like to prevent direct url access to some selected directories. But then make a few files inside the chosen directories accessible for direct url access. I'm having some trouble writing the < filesmatch > portion to allow access to the .php files inside the "xml/" directory. I'm wanting to include part of the "path" in the filesmatch directive, rather than create separate < directorymatch > directives for each directory i want certain files availabe in, but it doesn't work...works if I remove the "/xml/" and put <FilesMatch "\.(php)$">
In my httpd.conf I have a virtual directory set up. Inside the virtual directory I added the following:
<DirectoryMatch "^/data/servers/dev.site.com/web/administrator/(includes|xml|css|javascript|stylesheet|cache|classes|acco
unt_files)">
AddType application/x-httpd-php .php .html .htm
Options none
AllowOverride All
Order Deny,Allow
Deny from all
#Target all files in "xml/" directory that end in ".php"
<FilesMatch "/xml/\.(php)">
AddType application/x-httpd-php .php
Order Allow,Deny
Allow from all
</FilesMatch>
</DirectoryMatch>
Anyone know how I should write this?
Thanks for the help.
FilesMatch works purely on filenames - it doesn't look at the path portion at all, so you'll never get an '/xml/' in a filename in the FilesMatch block. That's why there's DirectoryMatch above. Match the directory there, then match filenames within the dirmatch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With