My Google-fu is failing me on that one...

I am attempting to create an Apache config which will only allow use of image, js, and css files inside a specific directory.

For instance, the next URL should work:

but this ought to be blocked:

The part I am battling with is setting it up working just for /dir/. The relaxation from the sites outdoors of /dir/ should not be influenced with this directive.

This is exactly what I've to date, which is not doing things i need (it appears to use to any or all sites).

<FilesMatch "\.(gif|jpe?g|jpg|png|js|css)$">
  Order deny,allow
  Allow from all

How do you only allow use of certain file types within /dir/ although not modify the relaxation of my sites?

I'd generally use mod_rewrite for your

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} ^/my_dir/[^/]+\.php$
RewriteRule .* - [F]

For simplicity, after i do that It's my job to invest the media files in their own individual directory. If however this is not a choice you could try the FilesMatch directive:

Place the a FilesMatch in the Directory.