Browse - Programming Tips - Apache: FilesMatch cannot occur within LocationMatch

Date: 2019sep5
Product: Apache
Keywords: configuration, config

Q.  Apache: FilesMatch cannot occur within LocationMatch

I got this error when trying something like this:

<LocationMatch "^/photos"> <FilesMatch "\.(jpg|png)$"> # Do something </FilesMatch> </LocationMatch>
A. A way that works:
<If "%{REQUEST_URI} =~ m#^/photos.*\.(jpg|png)$#"> # Do something </If>