Browser caching via .htaccess

Indien je gebruik wilt maken van browser caching, dan is dat mogelijk. Middels het toevoegen van onderstaand script aan de .htaccess file in het betreffende cPanel.

<IfModule mod_expires.c>
     ExpiresActive on
     ExpiresDefault                                      "access plus 1 month"
      # CSS
     ExpiresByType text/css                              "access plus 1 year"<br>
  # Data interchange
     ExpiresByType application/json                      "access plus 0 seconds"
     ExpiresByType application/xml                       "access plus 0 seconds"
     ExpiresByType text/xml                              "access plus 0 seconds"

  # Favicon (cannot be renamed!)
     ExpiresByType image/x-icon                          "access plus 1 week"

  # HTML components (HTCs)
     ExpiresByType text/x-component                      "access plus 1 month"

  # HTML
     ExpiresByType text/html                             "access plus 0 seconds"

  # JavaScript
     ExpiresByType application/javascript                "access plus 1 year"

  # Manifest files
     ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
     ExpiresByType text/cache-manifest                   "access plus 0 seconds"

  # Media
     ExpiresByType audio/ogg                             "access plus 1 month"
     ExpiresByType image/gif                             "access plus 1 month"
     ExpiresByType image/jpeg                            "access plus 1 month"
     ExpiresByType image/png                             "access plus 1 month"
     ExpiresByType video/mp4                             "access plus 1 month"
     ExpiresByType video/ogg                             "access plus 1 month"
     ExpiresByType video/webm                            "access plus 1 month"

  # Web feeds
     ExpiresByType application/atom+xml                  "access plus 1 hour"
     ExpiresByType application/rss+xml                   "access plus 1 hour"

  # Web fonts
     ExpiresByType application/font-woff2                "access plus 1 month"
     ExpiresByType application/font-woff                 "access plus 1 month"
     ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
     ExpiresByType application/x-font-ttf                "access plus 1 month"
     ExpiresByType font/opentype                         "access plus 1 month"
     ExpiresByType image/svg+xml                         "access plus 1 month"
</IfModule>
 
<IfModule mod_headers.c>
     Header unset ETag 
</IfModule>

 FileETag None
Heeft dit artikel je goed geholpen? Dank voor je feedback! Er is een probleem opgetreden bij het verzenden. Probeer opnieuw.