Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine multiple FilesMatch (specific files)

Tags:

.htaccess

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>
like image 471
Rocstar Avatar asked Sep 03 '25 09:09

Rocstar


1 Answers

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.

like image 84
Amit Verma Avatar answered Sep 05 '25 01:09

Amit Verma