Programming Tips - Apache: FilesMatch cannot occur within LocationMatch

Date: 2019sep5 Product: Apache Keywords: configuration, config, settings Q. Apache: FilesMatch cannot occur within LocationMatch I got this message when trying something like this:
<LocationMatch "^/photos"> <FilesMatch "\.(jpg|png)$"> # Do something </FilesMatch> </LocationMatch>
A. Here is a way that works:
<If "%{REQUEST_URI} =~ m#^/photos.*\.(jpg|png)$#"> # Do something </If>