What are the limitations of using the <Directory> directive in htaccess?

by Motivated   Last Updated August 14, 2019 03:01 AM

The directive below is intended to prevent/block the ability to execute PHP files in a particular directory.

<Directory ~ "/uploads/">
<Files "*.php">
  Require all denied
</Files>
</Directory>

According to a post on Stackoverflow, the Directory directive isn't permitted although the reference from Apache suggests otherwise

Directory and are used to enclose a group of directives that will apply only to the named directory and sub-directories of that directory. Any directive that is allowed in a directory context may be used. Directory-path is either the full path to a directory, or a wild-card string using Unix shell-style matching. In a wild-card string, ? matches any single character, and * matches any sequences of characters. You may also use [] character ranges. None of the wildcards match a `/' character, so will not match /home/user/public_html, but

Based on the understanding that the directory directive is supported;

  • what limitations if any are imposed by the code above?
  • is the code syntactically correctly?
Tags : htaccess


Related Questions


Updated September 05, 2017 07:01 AM

Updated March 24, 2017 11:01 AM

Updated February 20, 2018 00:01 AM

Updated June 14, 2018 15:01 PM

Updated January 12, 2018 20:01 PM