You need to check for the mod_headers.c
module:
<IfModule mod_headers.c>
(See this answer about the .so/.c stuff)
But the reason you're getting the 500 error is twofold.
First, the <FilesMatch>
container expects a regular expression, and "*.gif" isn't a valid regular expression. You probably just want to use the <Files>
container.
Second, the <If>
isn't available in apache 2.2, only version 2.4. If you aren't using apache 2.4, then you're not going to be able to use the <If>
container.