La velocità del sito web è fondamentale per l’esperienza dell’utente, la SEO e le conversioni. Un sito web lento può frustrare i visitatori, inducendoli ad abbandonare il sito prima ancora di avere la possibilità di esplorare i contenuti. Per questo motivo utilizziamo un plugin di caching per mantenere i nostri siti web veloci.
W3 Total Cache è un popolare e potente plugin per la cache di WordPress che può migliorare notevolmente le prestazioni del vostro sito web. Crea versioni statiche delle pagine, riducendo il carico del server e fornendo i contenuti ai visitatori molto più velocemente.
Questa guida per principianti fornisce istruzioni passo passo per installare e configurare W3 Total Cache sul vostro sito web WordPress. Vi spiegheremo le caratteristiche e le impostazioni principali per ottimizzare la velocità del vostro sito e creare un’esperienza più fluida e piacevole per i vostri utenti.
Nota dell’editore: non utilizziamo più W3 Total Cache sul nostro sito web e siamo passati a WP Rocket, un plugin premium per la cache. W3 Total Cache è comunque una soluzione valida che funziona bene.
Che cos’è W3 Total Cache?
W3 Total Cache è uno dei migliori plugin per la cache di WordPress che consente di migliorare facilmente le prestazioni e la velocità di WordPress.
Per impostazione predefinita, WordPress utilizza PHP per generare dinamicamente ogni pagina del sito web quando viene richiesta da un utente.
PHP è un linguaggio di programmazione lato server. Ciò significa che ogni richiesta dell’utente aumenta il carico sul server. Ciò influisce sulle prestazioni del sito web, sull’esperienza dell’utente e sulla SEO.
I plugin di caching di WordPress aiutano a ridurre questo problema saltando il PHP e servendo una copia in cache della pagina web.
Inoltre, consente di collegare facilmente il sito web a una CDN (content delivery network) per migliorare ulteriormente le prestazioni del sito.
Installazione di W3 Total Cache in WordPress
Prima di installare il plugin W3 Total Cache in WordPress, è necessario assicurarsi di aver disattivato qualsiasi altro plugin di caching sul proprio sito web. Questo vi aiuterà a risparmiare risorse del server e a prevenire eventuali conflitti tra i plugin.
Dopodiché, si può procedere all’installazione e all’attivazione del plugin W3 Total Cache. Per maggiori dettagli, consultate la nostra guida passo-passo su come installare un plugin di WordPress.
Dopo l’attivazione, W3 Total Cache aggiungerà alla barra laterale dell’amministrazione di WordPress una nuova voce di menu denominata Performance. Facendo clic su di essa si avvierà la procedura guidata di configurazione del plugin.
È sufficiente fare clic sul pulsante Avanti per continuare.
Per prima cosa, vi verrà chiesto di attivare la Cache di pagina. Fare clic sul pulsante Test Page Cache per continuare.
W3 Total Cache mostra diverse opzioni di motore di memorizzazione. È necessario scegliere quella che consente di risparmiare più tempo. Di solito, si tratta dell’opzione “Disk: Enhanced” per la maggior parte delle piattaforme di hosting condiviso.
Fare clic sul pulsante Avanti per continuare.
A questo punto, si potrà scegliere di testare la cache del database. Si consiglia di scegliere Nessuno. Per la maggior parte dei siti web di piccole e medie dimensioni, il server MySQL sarà in grado di recuperare i dati più rapidamente della cache del database.
Fare clic sul pulsante Avanti per passare alla fase successiva.
Si accede così alla sezione Object Cache. La cache a oggetti consente a W3 Total Cache di memorizzare le query del database per le pagine dinamiche e di riutilizzarle per migliorare le prestazioni.
Se il risultato del test mostra una differenza di pochi millisecondi, si può scegliere Nessuno.
Fare clic sul pulsante successivo per continuare.
Quindi, fare clic sul pulsante Test della cache del browser e selezionare l’opzione “Abilitato” sotto i risultati del test.
Questa opzione richiede al browser dell’utente di memorizzare una copia della pagina web per un periodo di tempo limitato. Il caricamento di una pagina dalla cache del browser è molto più veloce rispetto al caricamento dalla cache del server web.
Fare clic sul pulsante successivo per passare alla fase successiva.
Infine, la procedura guidata vi chiederà di abilitare il caricamento pigro delle immagini.
Ora, WordPress è dotato di un caricamento pigro incorporato per le immagini. Tuttavia, alcuni vecchi browser potrebbero non supportare questa funzione.
W3 Total Cache utilizza JavaScript per aggiungere il caricamento pigro delle immagini, che può essere ancora più veloce ed efficiente.
Dopodiché, fare clic sul pulsante Avanti per terminare l’installazione guidata e visualizzare la dashboard di W3 Total Cache.
Opzioni avanzate di caching in W3 Total Cache
Le impostazioni di base sono adatte alla maggior parte dei siti web. Tuttavia, ci sono molte opzioni avanzate che si possono configurare per migliorare ulteriormente le prestazioni.
Vediamo i più importanti.
Minimizzazione di JavaScript e CSS in W3 Total Cache
Il termine “minificare” è usato per descrivere un metodo che riduce le dimensioni dei file del sito web. Ciò avviene rimuovendo gli spazi bianchi, le linee e i caratteri non necessari dal codice sorgente.
Nota: la minimizzazione dei file JS e CSS può potenzialmente danneggiare il sito web. Se la attivate e il vostro sito non ha un aspetto corretto, disabilitate semplicemente queste opzioni.
W3 Total Cache consente di minificare facilmente anche il codice sorgente JavaScript, CSS e HTML. Tuttavia, si consiglia di minificare solo i file JavaScript e CSS.
Basta andare alla pagina Performance ” Minify e scorrere fino alla sezione JS.
Selezionare la casella accanto a “Impostazioni di minificazione JS” per attivarla.
Ora, scorrere fino alla sezione CSS e abilitare le impostazioni di minificazione CSS nello stesso modo.
Non dimenticate di fare clic sul pulsante Salva tutte le impostazioni per memorizzare le impostazioni.
Per metodi alternativi, consultate la nostra guida su come minificare i file JavaScript e CSS in WordPress.
Abilitazione del supporto CDN in W3 Total Cache
Le CDN o reti di distribuzione dei contenuti aiutano a migliorare ulteriormente le prestazioni del sito web servendo file statici come immagini, CSS e JavaScript da una rete globale di server.
Questo riduce il carico sul server di hosting WordPress e migliora la velocità di caricamento delle pagine.
W3 Total Cache è dotato di un supporto integrato per diverse piattaforme CDN.
Consigliamo di utilizzare Bunny.net, la migliore soluzione CDN sul mercato. Questa è la soluzione che utilizziamo per il nostro sito web OptinMonster.
Innanzitutto, è necessario registrarsi per ottenere un account Bunny.net. Dopo la registrazione, è necessario creare una Pull Zone per il proprio sito web.
Una zona pull aggiunge un nome host al CDN Bunny.net. Questo nome host viene quindi utilizzato per servire i file statici del vostro sito web.
Aggiungete un nome per la vostra zona pull e poi fornite il nome di dominio del vostro sito web.
Dopo aver aggiunto la pullzone, è necessario visitare la pagina Performance ” Impostazioni generali.
Quindi, scorrere verso il basso fino alla sezione CDN.
Selezionare la casella Abilita accanto all’opzione CDN e scegliere Generic Mirror accanto all’opzione Tipo di CDN.
Non dimenticate di fare clic sul pulsante Salva tutte le modifiche per memorizzare le impostazioni.
Successivamente, è necessario visitare la pagina Performance ” CDN e scorrere fino alla sezione Configurazione: Oggetti.
Da qui, è necessario aggiungere l’hostname creato in precedenza per la pullzone e fare clic sul pulsante Test mirror.
W3 Total Cache verificherà la disponibilità del vostro hostname e mostrerà il messaggio Test Passed (Test superato) in caso di esito positivo.
A questo punto è possibile fare clic sul pulsante Salva tutte le modifiche per memorizzare le impostazioni.
W3 Total Cache inizierà a servire le risorse statiche dal server CDN.
W3 Total Cache funziona bene anche con il CDN gratuito di Cloudflare. In alternativa, è possibile utilizzarlo anche con Sucuri, il miglior servizio di firewall per siti web con servizio CDN integrato.
Risoluzione dei problemi di W3 Total Cache
Una volta configurato correttamente W3 Total Cache, dovrebbe funzionare perfettamente in background per migliorare la velocità di WordPress e incrementare le prestazioni.
A volte può capitare che non si vedano subito le modifiche apportate al sito web o che un plugin non funzioni correttamente.
La ragione più comune di questi problemi è che probabilmente state vedendo una vecchia versione in cache del vostro sito web.
Questo problema può essere facilmente risolto cancellando la cache di WordPress.
È sufficiente fare clic sul menu Prestazioni in alto e selezionare l’opzione Elimina tutte le cache. W3 Total Cache cancellerà tutti i contenuti in cache del vostro sito web.
Se si vede ancora la vecchia versione del sito web, provare a svuotare anche la cache del browser.
Speriamo che questo articolo vi abbia aiutato a installare e configurare W3 Total Cache in WordPress. Potreste anche consultare la nostra guida su come aumentare la velocità di caricamento delle pagine su WPBeginner e la nostra scelta dei migliori plugin di caching per WordPress per velocizzare il vostro sito web.
Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.
hisweeto
after installation of W3TC i cant upload imgs from my web profile page .. please help
Manolis
hi,
how i can restore my settings to default? how i can restore the redirect of cdn.mydomain.com to my default domain name???
Ashutosh Kumar Gupta
I have recently uploaded wordpress in two new sites. While configuring w3 total cache, I am cannot enable page cache after so many attempts. Other websites are working fine.
Hansjörg Leichsenring
Hi, do you have any tipps of how to make W3 Total Cache and AdRotate work together? It seems to be a horrible Task.
Cheers from Germany
Hansjörg
WPBeginner Staff
You can add your shopping cart page as an exception in w3 total cache. Under Performance > Page Cache scroll down to advanced section where you will find the option ‘Never cache the following pages’. For example, if your eCommerce plugin uses a page cart for checkout, then simply enter “cart/” to exclude that page or “cart/*” to exclude that page and all sub-pages. (Without the quotes, of course.)
Marou Wing
Hi Guys, thank you for the awesome article, it made my site much faster than before! However I have encountered with a little issue. My site has webshop and the checkout page (due to the Credit Card payment option) has https (I have my own SSL hosted by RapidSSL). So the checkout page (I assume because of the SSL is totally messed up when the W3TotalCache is enabled, no formats, no pictures, no colours only text…) How can I fix this issue, do you have any recommendation? Thank you, Marou
WPBeginner Staff
We haven’t noticed any significant conflicts on any of our websites where we use it. Even then, if you come across a conflict then notify the plugin author by using the support tab on the plugin’s page.
adeem jan
Thanks for writing this tutorial on how to setup and decrease a blog load time using W3 total cache.
I use this same plugin on one of my blogs, the resulting speed of the blog is awesome.
Although, i have seen many people complain about this plugin that it sometimes conflict with other wordpress plugins.
I don’t know if you have experienced this in person?
Roger Phillips
Hi thanks for the video I enjoyed it, I’ve used w3 total cache for over 5 years on all four of my personal sites and I honestly have to say I’ve alway had better luck 90% of the time using it right out of the box, less likely to break other function that way. Kind of the risk vrs rewards factor and that normally persuades me to just use it out of the box. After watching this video and decided to give the settings you requested a try, You helped me out quite a bit. My site went up in speed from 82% to 97% page speed, and yslow score went from 72% to 93%, thanks for the setting can’t wait to try them on my other sites!
Fish
Arif Ahmed
I used W3 cache through my developer. My site was acting weirdly, it does not load properly on first instance and when I refresh the page it is loaded properly. This happens with every page. When I told my developer, he told me that it because my internet speed is slow and the page is not able to serve from cache. So why is this happening ? Any clue
Rachael
Like the previous person Ss, I am new to WP and I followed this plugin tutorial video (aside from the minify, CDN stuff). I got the same message at the top of my pages in wp admin: “The setting change(s) made either invalidate the cached data or modify the behavior of the site. now to provide a consistent user experience. ” Why did this happen and Should I dismiss it or click on the empty cache button? Help, Please!
imssarl
I installed that way, but my site design is all messed. I have my blog installed on a subdomain: blog.mydomain.com ; what should I set for the cdn? cdn.blog.mydomain.com?
Jimmy
Yes, that’s how you do it. But I would prefer example.com/blog/ for better SEO.
Salud Casera
I followed the instructions for beginners and all it tooks was three clicks to set it all up (if you are not using CDN). It would be good to have a more advanced version of this post.
Edit : After testing for speed, it only made my website slower.
bemed
I mean I installed W3 Total Cache on the Network Admin but it does not show on the website that I want it to be active.
Does it handles multi-site installations or it only works individually?
bemed
Hoe does it work on a multi site installation?
WPBeginner Staff
Take a look at this URL:
http://site1.example.com
In this URL site1 is a subdomain of example.com
Macca Sherifi
Hi guys,
Great article, but what exactly do you mean about the subdomains? Any info would be appreciated!
Cheers,
Macca
Chad Rogez
That was just what I needed. Made the setup much easier and the details allowed me to understand what the purpose of each function was. Thanks for the details!
Kristine
Hi, thank you for the tips! I read on some blog, they check all the setting (minify, database cache, etc) without explain what the function does..
Just setup my w3 today
Ashutosh Bhardwaj
Hi, This was a great step guid, well i was searching something like disabling w3tc adding query string to my images inserted in post. Actually it breaks the lightbox effect. There seems to be not an option on panel
Anyway Gud Post
md
This was extremely helpful. W3TC has some of the most non-intuitive settings I have ever seen.
Ss
Thanks for this tut, I’m pretty new to wp and all this helps a great deal! I installed and activated this plugin as per your post (aside for the CDN part). However the following message appears at the top of all pages in wp admin: “The setting change(s) made either invalidate the cached data or modify the behavior of the site. now to provide a consistent user experience. ”
Should I dismiss this or click on the empty page cache button?
Erin Singh
Thank you for posting this tutorial. The W3 Total Cache that I installed displays this General Setting. Does this General Setting need to be enabled as well?
Craig
Very helpful post! Been using W3TC for quite awhile, but configuring a CDN can be a little tricky. This guide made it a breeze. Thank you!
Fauzul
Luckily found this short tutorial, my blog page load increased severely after setting up the caches. Now I know better what to turn on and what cache to leave disabled. On shared hosting, in my opinion it’s only good to turn on page cache and browser cache.
Now going to try it with a CDN. Hopefully things can improve further.
Susan
Hi,
I using a wp multi site install and Cloudflare but I just cannot find any instructions on how to configure W3.
When activated network wide there is nowhere to add individual distributions for each sub domain.
Or else I’m missing something!
Any help is much appreciated
cheers
WPBeginner Support
You will find CloudFlare available as an extension under Performance » Extensions. After activating CloudFlare extension you will be able to see its settings.
Admin
Ejaz Khan
Thanks!
Sharon
Awesome article! Just what I was looking for – my site is on Hostgator and I’d love to use both W3 Total Cache and Max CDN. Perfect.
BUT I got lost at the point of creating subdomains. I just don’t understand what that means or how to create one. Just make one up? Find one somewhere on my site. Very confused.
My site is slow – it gets a C at best on GTMetrixs, and I’m preparing to do a big campaign. I need help.
Do ya’ll offer support services? I saw that you do free blog set ups. Would accept payment to help set these up for me?
Sharon
avgjoegeek
Sharon – dunno if you received help on this or not? Feel free to contact me if its still not resolved.
Mike Hirst
Thanks so much for this article. My site is blazing fast now!
Zubair
Hi ! its a nice plugin . but i installed WP Fastest cache instead , so now i am facing a little problem with this . i have used contact form 7 with really simple captcha but after installing the WP Fastest Cache the captcha image is broken in the website. so how to get rid of this or if i install w3tc will i overcome this problem.
Regards
Zubair
Ashutosh Bhardwaj
That might be the reason, because in order to make everything cachable, ur plugin might have added a query string as suffix to image name, and it broke.
Ask plugin support, they will help for sure
Philip Verghese Ariel
Hi Admin & Syed Balkhi.
What a pleasant land here.
I am really in search of such a page
since I am new to this platform called WP
Recently i created (migrated) my blogger page here with the help of one of my blogger friends. Now I am here via Arun’s page here at WP, and found this place is a good place for a WP beginner like me I think this looks like a bit advanced page to me, so i am going
to your Archives WPBEGINNER ARCHIVES” to find some basic lessons
Anyways I will be here to look and study around
Thanks a lot for all your efforts to put these lessons in a systematic way.
I am bookmarking this page.
Have a wonderful time.
Best Regards
Philip
Alex
thanks guys for your awesome job.
In the dashboard W3 gives a tip to upgrade to Pro for $99. However all the functions you described can be checked without upgrade.
Then what this upgrade is for? – should i go ahead and purchase the upgrade?
avgjoegeek
That is for their “Pro” Service. If you use Genesis framework they will offer additional ‘special’ caching and monitoring to help speed up your site more. Most people do not need this.
Ashutosh Bhardwaj
So u need not purchase it simple
Carla
I’ve been trying to set up this plugin for ages. I just left the default settings and it was very helpful. Now that I have additional settings checked, my site is super speedy. Thanks so much! I did not set the CDN though because I have ClourFlare enbaled.
David Geer
I am at the step where I configure the CDN section in W3TC. I added cdn.davidgeer.com and clicked add cname. It added it and said it was reserved for CSS. Then another field popped up to add another CNAME and it said it is reserved for js in . Should I keep adding each of my consecutive cnames to the available cname fields that pop up here in W3TC and then save settings?
WPBeginner Support
You need to add CNAMEs you created with MAX CDN.
Admin
Adam Lindsey
I seem to be having an issue as well. There is the long CNAME url.url.netdna.cdn.com that works, but if I use the cdn.tnmedia.com, cdn1.tnmedia.com, etc. It doesn’t work. Isn’t it better to have JS files pulling form one subdomain and have another pulled form a different one or am I way off base here?
Joe DeCaro
I love your site. I installed W3TC and set it up as you suggested. I’m on shared hosting. Now that it is installed, I’m getting emails from readers saying they can’t see our latest posts as they go up.
Did I do something wrong?
I set the browser cache settings step by step as you advised.
What may have cause this new issue for my readers since installing the W3?
Thanks.
My site is MetsmerizedOnline.com
Osnilton Mozarino
Thanks for the great article!!! As usual very well written and informative.
Question: I now have a pretty clear idea about CDN, however for a regional or national only web site, will it still be benefitial to use it, as the hosting server(s) are already in the main cities, say close enough? As it seems to be a great thing for international web sites.
Thank you
WPBeginner Support
Yes if u live in a big country like US. If you are in a small country then no.
Admin
Himanshu Goel
Hey I have tried installing and managing with this plugin and I don’t own a cdn. do this plugin works with cdn better or we can try some extra efforts in settings to make this work better without cdn.
Should we actually use caching plugin if we are not running up with cdn services (I am involving every cache plugin)
WPBeginner Support
W3 Total Caches works without CDN and is still very useful. However, using a CDN service will further boost your page load time.
Admin
Zalmey
My Question is that, will I get better performance from W3TC without MaxCDN & CloudFlare. Does anyone using it with these 2 and having a good load time?
avgjoegeek
If setup properly? W3TC/MaxCDN and Cloudflare can significantly speed up your website.
I used W3TC to configure to use MaxCDN. Then did a manual install for CloudFlare, You don’t need to configure it within W3TC. And it is fast… very fast once it’s all setup!
Andy Crichton
Great article. I know just about enough to get myself in trouble, so I did ask the MaxCDN guys a lot of questions before and during setup. I asked a couple of times about the subdomains, I said it sounds cool and logical to have the 4 extra to serve certain files “instantly” – they said the difference in delivery is almost non existent, like 10ms. So I havent bothered. Have you really seen a significant difference with / without the 4 subdomains at work?
thanks
PS I didnt know about your affiiation before I signed up to MaxCDN, but anyone reading, wow, the company is brilliant! There was an issue with my forum plugin – when the CDN was installed, the theme broke if you did a quote, and also members couldnt login. MaxCDN analysed it and I gave them admin access and they sorted it. Also the delivery of the site (hosted in Colorado) now in Europe is down from 4 secs to 1.5 according to pingdom.
WPBeginner Support
Andy, its up to you, we would say that every millisecond counts.
Admin
Sherif
Hi,
Thanks for your time writing this, it is very helpful and i setup W3TC but after that i started getting a strange error about database connection lost every time i try to post new post or edit and existing one,any clue what should i do or where to start looking around
If i disabled the plugin, this error message is not showing any more and i am able to post normally
Sherif
WPBeginner Support
Try turning off Database Caching, if that does not work, then you can try to optimize your WordPress database using phpMyAdmin.
Admin
Donna Caissie
I installed Total Cache several weeks ago, and since then, using my backend has been a nightmare. Every time I tried to do anything in the backend, my browser (Firefox) would hang. I finally deactivated Total Cache today, and now my backend works just ducky.
Hayslan
Hey guys, what do you think of leaving somewhere in the post – maybe at the end, a ‘log’ of what section / topic went updated?
A long time ago I read this article and now for example I have no idea at what point it went updated.
Would not it be helpful? Let me know!
Cynic
Great article. Thanks for sharing.
Savvas
Does it work ok with wp multisite??
WPBeginner Support
w3 total cache supports multisite
Admin
Steve
I’ve tried several times to install caching plugins (both W3 Total Cache and WP Super Cache) and in every case, my overall site performance takes a major hit as soon as the plugin is activated/configured.
This time, I followed the instructions to the letter as shown above. However (as has occurred in every other time I’ve tried), load time throughout the site has at least tripled.
The one thing I didn’t do in every case is get a CDN, due to the cost involved.
So my question is this.. do the caching plugins only work in conjunction with a CDN?
If so, is there any other way to speed up performance (aside from the obvious – removing plugins, etc). I use WP Optimize regularly.
WPBeginner Support
There could be some server configuration problem on your host’s end.
Admin
Steve
Could you give me more details on what to ask about? My hosting service service is usually good about that sort of thing, but I’d need to know specifically what to ask about.
Andrew
Turn off database caching if you are on shared hosting, it will bring your speed back up.
Abhisek
I am planning to go for maxCDN but, i have a dilemma that, i use a sub-domain to store all my media files something like this – media.example.com. As a result Wp-Smush it plugin no more works and i have to compress images myself using png-gauntlet software in windows. Will this sub-domain also create any problem in switching to maxCDN ?
Manasseh Copinger
Great post really like every single post from you.
Shahraar Khan
Very nice tutorial . But I personally like wp Super cache
Jeremy Myers
First, where is your “after” screen shot from Pingdom? That “before” test was pretty dang good, and I am curious to see if it actually improved.
Second, I have done a lot of testing between W3 Total Cache and WP Super Cache. I agree with W3 has more options and seems to be a better plugin, but with W3, my server response time nearly tripled! It went from about .25 seconds to almost a full second. Why is this?
Third, what about Cloudflare integration? Any suggestions one way or the other?
Denise Blackman
Hi Jeremy. I don’t have the answer to the increased response time of your server with W3, but I had the same problem. Mine, however, was even more severe, with an increase to almost 1.25 sec. I wish someone could answer this. My host provider has no answer either. My personal guess is that the server that is hosting my account, which is a shared server, is over taxed. It is normally what happens when an account suddenly has major performance issues.
In reference to CloudFlare, I have tried to integrate it, but had problems with my theme. I had to disable it. It made way too many changes to my CSS. I don’t know a lot about CloudFlare, and it sounded great. I just couldn’t figure out a way to make it work with my theme at all.
Dmitriy
Great article, very detailed!
If someone has any questions regarding MaxCDN feel free to ask me.
Thank you
Alex
Dmitry,
Due to localized business activity my website is set for a specific location, Moscow Russia. That said I don’t expect people from other cities to bother me. Do you think I still should go for the MaxCDN?
Thanks
Raghu
One more step for MaxCDN : Add noindex to cdn contents to prevent Google from indexing CDN contents which will create duplicate content issues.
It’s under Zones > Pull zones > SEO
Check enable and use custom robots (with default code for robots.txt)
Alex
Raghu,
thanks for the heads-up. Do you mean I need to edit robots.txt or there are just default options that I need to check in Zones > Pull zones > SEO section?
The necessity to touch robots.txt kind of scares me as I am not a coder.
thanks