1

I want to prevent hotlinking to all subfolders in /var/www/store but at the same time allow linking to its index page. I tried doing this:

<Directory "/var/www/store">
  DirectoryIndex index.html
</Directory>
<Directory "/var/www/store/*">
  SetEnvIfNoCase Referer ^http://example.com/ accept
  Require env accept
</Directory>

But the index.html is forbidden when I tried accessing from a link outside. Next I tried appending a trailing slash.

<Directory "/var/www/store/*/">

It doesn't work too. Is this a bug in Apache? Ain't the <Directory> directive supposed to match directories only?

1 Answers1

1

In my experience, <Directories> match anything in a directory or subdirectory.

I've not done this before, but this would seem correct behavior to me. Why not try fold the 2 Directory entries into 1 and add

SetEnvIfNoCase Request_URI ".html" accept

davidgo
  • 6,504