Rocstar
Rocstar

Reputation: 1477

Combine multiple FilesMatch (specific files)

How can I combine multiple FilesMatch for specific files ?

All the examples I found are for combining file extensions

In my case I only want to allow 3 files :

/img/logo.png
/sound/true.p3
/sound/false.mp3

I tested that but it's not clean :

<FilesMatch logo.png>
  Allow from all
  Satisfy Any
</FilesMatch>
<FilesMatch true.mp3>
  Allow from all
  Satisfy Any
</FilesMatch>
<FilesMatch false.mp3>
  Allow from all
  Satisfy Any
</FilesMatch>

Upvotes: 4

Views: 4771

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

You can use <filesMatch> with regex pattern to test multiple files

<filesMatch "(logo\.png|true\.p3|test\.jpg)">
Allow from all
Satisfy Any
</filesMatch>

Documentation of the FilesMatch directive is here.

Upvotes: 8

Related Questions