I came across a strange problem today when updating .htaccess to update my site.
Like most sites, when a user requests a resource, it's fed through a script for processing. In my case, I have everything run through one PHP script.
I'm trying to make it where if a favicon for any device is requested (including the png icons for phones), I want the caching to be immutable (where the browser never requests the server for the icon again).
In PHP, I have this code for the icons because it generates the png icons:
apache_setenv('isico','yes');
I also have a static favicon.ico file.
This is the part in .htaccess when active causes the entire website to return a 500 internal server error:
<FilesMatch "^(favicon\.ico)$">
SetEnv isico yes
</FilesMatch>
Header set Cache-Control public,max-age=77777777,immutable env=isico
I know an answer can be to create separate icon files as static files, but I have a system already setup to generate the same icon at different sizes on the fly through the script.
But other than that, is there another way I can fix the above .htaccess code to make it work? I'm using apache 2.4.37.