I’ve been testing this in several browsers… and can’t get SVGs inside /content subfolders to cache… weirdly enough the same SVGs cache normally once moved to any /assets sub folders.
I’ve fiddled with the .htaccess for a a bit, tried to implement some of the html5boilerplate best practices and still nothing. Tested several different files/browers combos, but only on mac os x.
Combining the URL manually is not recommended. DS is a dynamic directory separator constant BTW, you shouldn’t use it for URLs or your URLs will break when running your site on a Windows server (DS becomes a backslash).
Letting Kirby do the URL building for you (as in your second example) is the safest way of doing it.
But a general note: You aren’t telling the browser that you want it to cache your image yet. You need to add a rule for Apache’s mod_expires in your .htaccess, otherwise the browser won’t always cache your images.
You can make your own settings as you deem appropriate, this is just an example I grabbed from a .htaccess file of a site I developed in the past (in most cases I don’t use .htaccess files but put the stuff in a server config file)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "modification plus 1 year"
ExpiresByType text/javascript "modification plus 1 year"
ExpiresByType application/javascript "modification plus 1 year"
ExpiresByType application/x-javascript "modification plus 1 year"
ExpiresByType application/font-woff "modification plus 1 year"
ExpiresByType image/svg+xml "modification plus 1 year"
ExpiresByType application/vnd.ms-fontobject "modification plus 1 year"
ExpiresByType application/x-font-ttf "modification plus 1 year"
ExpiresByType application/x-font-truetype "modification plus 1 year"
ExpiresByType application/x-font-opentype "modification plus 1 year"
</IfModule>
You can add more content types if you need.
Either mod_expires or mod_headers is enough. You can use both together, but it doesn’t make any sense. mod_headers is only needed if you need more fine grained control over the caching by using the Cache-Control header.