Dear StackOverflowers,
I’m looking for a way to disable access to all folders of a specific name, I dynamically make folders with my web app, but some of those folders musn’t be accessed by others.
say my app makes folders:
Images
Videos
Scripts
and I want to make all the created folders Scripts be inaccessible? How would I go and make this happen? I’m not that familiar with htaccess, I know its possible to put a htaccess file in every directory, but I want to limit the disk read/writes to make sure the app is fast enough, is there a generic way to do this with 1 htaccess file?
A million thanks in advance!
Using Apache’s
<DirectoryMatch>directive, you can easily set this up at the server level or VirtualHost level. However, you need access to the core configuration files to do so.To accomplish the same in a .htaccess file, you’ll probably need to make a
RewriteRuleat the top level.The above should match requests like: