title: Enable compression and caching of SVG files in .htaccess file
body: <p>When I analyze my website with Google PageSpeed Insight, I should fix some problems regarding compression of SVG files.</p>
  
  <p>I've been looking all around the web trying to find a solution on this problem, but no matter what I do it doesn't seem to work, so therefor I'm now asking you guys. </p>
  
  <p>I've checked if gzip is enabled through multiple tools on the web, and that seem to be true.</p>
  
  <p>So far I got this in my .htaccess file. </p>
  
  <pre><code>RewriteEngine On
  Options FollowSymLinks
  
  RewriteBase /
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ /#/$1 [L]
  
  AddType     image/svg+xml              svg svgz
  AddEncoding gzip                       svgz
  
  ## EXPIRES CACHING ##
  &lt;IfModule mod_expires.c&gt;
  ExpiresActive On
  ExpiresByType image/jpg "access 1 month"
  ExpiresByType image/jpeg "access 1 month"
  ExpiresByType image/gif "access 1 month"
  ExpiresByType image/png "access 1 month"
  ExpiresByType text/css "access 1 week"
  ExpiresByType text/html "access 1 day"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType image/x-icon "access 1 month"
  ExpiresByType image/svg "access 1 month"
  ExpiresDefault "access 1 month"
  &lt;/IfModule&gt;
  ## EXPIRES CACHING ##
  
  ## FILE COMPRESSION ##
  &lt;ifModule mod_gzip.c&gt;
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|svg|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_include mime ^image/svg+xml.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  &lt;/ifModule&gt;
  ## FILE COMPRESSION ##
  
  # mod_deflate configuration
  &lt;IfModule mod_deflate.c&gt;
  # Restrict compression to these MIME types
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xml+rss
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE image/svg
  AddOutputFilterByType DEFLATE image/svg+xml
  &lt;IfModule mod_headers.c&gt;
      # Make sure proxies don't deliver the wrong content
      Header append Vary User-Agent env=!dont-vary
  &lt;/IfModule&gt;
  </code></pre>
  
  <p></p>
  
  <p>I really hope for someone to come up with a solution to my problem since I've tried myself for several hours.</p>
  
  <p>Browser caching doesn't work for SVG neither. Maybe there are a similar problem?</p>