Enabling some kind of cache is important for your site performance, and particularly if you're using WordPress.

There's a number of different WordPress plugins to enable and manage different cache mechanism, but often using them rightly is not so easy, or the result may be also far from expected.

There's a simple way to enable cache, just adding a few rows of code in your .htaccess file, like this:

<IfModule mod_expires.c>
ExpiresActive On

# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"

# Video
ExpiresByType video/webm "access plus 1 year"
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/mpeg "access plus 1 year"

# Fonts
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"

# CSS, JavaScript
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"

# Others
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
</IfModule>

 

You can edit previous code as needed, in order to tailor the cache mechanism to your own needs.

Found this article interesting?
Subscribe to DomainRegister´s newsletter!

You can unsubscribe at any time by simply clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp s privacy practices here.

  • WordPress, cache, .htaccess
  • 0 uporabniku/om je bi članek v pomoč
Vam je bil odgovor v pomoč?

Povezani članki

 Come visualizzare le statistiche del sito (log e Webalizer)

Nota: questa guida si applica a tutti i nostri piani hosting Linux shared (Basic, Starter Cloud,...

 Come abilitare la compressione gzip sul proprio sito

Nota: questa guida si applica a tutti i nostri piani hosting Linux shared (Basic, Starter Cloud,...

 Ho caricato il mio sito, però continuo a vedere la pagina di cortesia: perchè?

La pagina di cortesia creata automaticamente per ogni servizio di hosting Linux è un file...

 How to Manage Cron Jobs

To access "Cron jobs" menu, sign into DirectAdmin and then click on the "Advanced Features" icon,...

 How to Install a SSL certificate on DirectAdmin

To install in DirectAdmin a commercial SSL certificate you have just issued, you need:...