title: HTTP Caching URLs with Query String
body: <p>I am currently storing svg code in arrays in a php file that, in short, I am then referencing to throughout the site to retrieve the desired image.</p>
  
  <p><strong>The file looks something like this:</strong></p>
  
  <pre><code>&lt;?php
  $svg_ticons = array(...);
  $svg_icons = array(...);
  $svg_inputs = array(
      'checkbox_0' =&gt; '&lt;svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0" y="0" viewBox="0 0 60 60" enable-background="new 0 0 60 60" xml:space="preserve"&gt;&lt;symbol id="Checkbox_Blank" viewBox="-7.5 -7.5 15 15"&gt;&lt;path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M-4.81 6.97h9.63c1.19 0 2.16-0.97 2.16-2.16v-9.63c0-1.19-0.97-2.16-2.16-2.16H-4.81c-1.19 0-2.16 0.97-2.16 2.16v9.63C-6.98 6-6 6.97-4.81 6.97L-4.81 6.97z"/&gt;&lt;path fill="#333333" d="M4.82-7.5h-9.63c-1.48 0-2.68 1.21-2.68 2.69v9.63c0 1.48 1.2 2.69 2.68 2.69h9.63c1.48 0 2.68-1.21 2.68-2.69V-4.81C7.5-6.29 6.3-7.5 4.82-7.5zM-4.82 6.45c-0.9 0-1.64-0.73-1.64-1.64V-4.81c0-0.9 0.74-1.64 1.64-1.64h9.63c0.9 0 1.64 0.73 1.64 1.64v9.63c0 0.9-0.74 1.64-1.64 1.64H-4.82z"/&gt;&lt;/symbol&gt;&lt;use xlink:href="#Checkbox_Blank" width="15" height="15" x="-7.5" y="-7.5" transform="matrix(4 0 0 -4 29.9997253 29.9989338)" overflow="visible"/&gt;&lt;/svg&gt;'
  );
  
  $svgall = $svg_ticons+$svg_icons+$svg_inputs;
  if(array_pop((explode("/", $_SERVER['SCRIPT_FILENAME']))) == array_pop((explode("/", __FILE__)))){
      if($reqsvg = $_GET["r"]?:false){header("Content-type: image/svg+xml"); echo $svgall[$reqsvg]; exit();}
  }
  ?&gt;
  </code></pre>
  
  <p>So the when I call to these images, let us say, as a background-image, it looks something like this:</p>
  
  <pre><code>background-image:url(DOMAIN/images/svg.php?r=checkbox_0);
  </code></pre>
  
  <p>Unfortunately, these 'images' are not being cached, which is causing a very undesirable delay time upon page load. <strong>So my question is: <em>How can I cache from urls with query string?</strong> (.htaccess solution is prefered.)</em></p>
  
  <p><strong>Side Note:</strong>
  I am aware of this <a href="https://stackoverflow.com/questions/850187/caching-from-urls-with-a-query-string">post</a>. However, the answer marked is not my solution.</p>
  
  <p><strong><em>Edit</strong>: I am not simply asking how to enable caching. I am already aware of how to do that. Parts of my site are caching beautifully. I am looking to <strong>specifically cache from urls with a query string.</em></strong></p>