WP Super Cache

Description

Cette extension génère des fichiers html statiques à partir de votre site WordPress dynamique. Une fois qu’un fichier HTML est généré, votre serveur web servira ce fichier au lieu de traiter les scripts PHP de WordPress qui sont comparativement plus lourds et plus coûteux.

Les fichiers HTML statiques seront servis à la grande majorité des internautes :

  • Qui ne sont pas connectés.
  • Qui n’ont pas laissé de commentaire sur votre site.
  • Ou qui n’ont pas consulté une publication protégée par un mot de passe.

99% de vos visiteurs recevront des fichiers HTML statiques. Un fichier mis en cache peut être servi des milliers de fois. Les autres visiteurs recevront des fichiers mis en cache personnalisés en fonction de leur visite. S’ils sont connectés ou s’ils ont laissé des commentaires, ces détails seront affichés et mis en cache pour eux.

The plugin serves cached files in 3 ways (ranked by speed):

  1. Expert. La méthode la plus rapide consiste à utiliser Apache mod_rewrite (ou tout autre module similaire pris en charge par votre serveur web) pour servir des fichiers HTML statiques « supercachés ». Cette méthode contourne complètement PHP et est extrêmement rapide. Si votre serveur est frappé par un déluge de trafic, il a plus de chances de s’en sortir, car les requêtes sont plus « légères ». Cela nécessite le module Apache mod_rewrite (qui est probablement installé si vous avez des permaliens personnalisés) et une modification de votre fichier .htaccess qui est risquée et peut faire tomber votre site si elle est modifiée de manière incorrecte.
  2. Simple. Les fichiers statiques « supercachés » peuvent être servis par PHP et c’est la manière recommandée d’utiliser l’extension. Elle servira un fichier « supercaché » s’il existe et c’est presque aussi rapide que la méthode mod_rewrite. C’est plus facile à configurer car le fichier .htaccess n’a pas besoin d’être modifié. Vous avez toujours besoin d’un permalien personnalisé. Vous pouvez conserver des parties de votre page dynamiques dans ce mode de mise en cache.
  3. Mise en cache WP-Cache. Elle est principalement utilisé pour mettre en cache des pages pour des internautes connus, des URLs avec des paramètres et des flux. Les internautes connus sont les internautes connectés, les visiteurs qui laissent des commentaires ou ceux qui devraient voir des données personnalisées par compte. C’est la méthode de mise en cache la plus flexible et légèrement plus lente. La mise en cache de WP-Cache mettra également en cache les visites d’internautes inconnus si le supercaching est désactivé. Vous pouvez également avoir des parties dynamiques sur votre page dans ce mode. Ce mode est toujours activé mais vous pouvez désactiver la mise en cache pour les internautes connus, les URLs avec des paramètres, ou les flux séparément. Définissez la constante « DISABLE_SUPERCACHE » à 1 dans votre wp-config.php si vous voulez utiliser uniquement la mise en cache de WP-Cache.

Si vous n’êtes pas à l’aise avec l’édition de fichiers PHP, utilisez le mode simple. Il est facile à mettre en place et très rapide.

Réglages recommandés

  1. Mise en cache simple.
  2. Compresser les pages.
  3. Ne pas mettre en cache les pages pour les internautes connus.
  4. Reconstruction du cache.
  5. Support CDN.
  6. Vérifications supplémentaires de la page d’accueil.

Le ramassage miettes est l’action de nettoyer les fichiers de cache qui sont périmés et périmés. Il n’y a pas de valeur correcte pour le délai d’expiration, mais un bon point de départ est 1800 secondes.

Envisagez de supprimer le contenu de la zone de texte « Agents utilisateurs rejetés » et autorisez les moteurs de recherche à mettre les fichiers en cache pour vous.

Préchargez autant de publications que possible et activez le « mode préchargement ». La suppression (ramasse miettes) des vieux fichiers mis en cache sera désactivé. Si vous ne vous souciez pas de la mise à jour fréquente des widgets de la colonne latérale, réglez l’intervalle de préchargement sur 2880 minutes (2 jours) afin que toutes vos publications ne soient pas mis en cache très souvent. Lorsque le préchargement a lieu, les fichiers de cache de la publication à rafraîchir sont supprimés puis régénérés. Ensuite, un ramassage de tous les anciens fichiers est effectué pour nettoyer les fichiers de cache périmés.
Même si le mode de préchargement est activé, les fichiers en cache sont toujours supprimés lorsque les messages sont modifiés ou que des commentaires sont formulés.

Développement

  • Le développement actif de cette extension est pris en charge sur GitHub.
  • La traduction de l’extension dans différentes langues se trouve sur la page de traduction.

Documentation

Si vous avez besoin de plus d’informations, vous pouvez consulter le wiki ou la documentation du développeur.

Préchargement

Vous pouvez générer des fichiers en cache pour les articles, les catégories et les balises de votre site par préchargement. Le préchargement visite chaque page de votre site et génère une page en cache au fur et à mesure, comme n’importe quel autre visiteur du site. En raison de la nature séquentielle de cette fonction, le préchargement d’un site complet peut prendre du temps s’il y a beaucoup de pages.
Pour rendre le préchargement plus efficace, il peut être utile de désactiver le ramasse miettes afin que les anciens fichiers de cache ne soient pas supprimés. Pour ce faire, il suffit d’activer le « mode préchargement » dans les réglages. Sachez toutefois que les pages finiront par être obsolètes, mais que les mises à jour effectuées en soumettant des commentaires ou en modifiant des articles effaceront des parties du cache.

Ramasse-miettes

Votre répertoire de cache se remplit au fil du temps, ce qui occupe de l’espace sur votre serveur. Si l’espace est limité ou facturé en fonction de la capacité, ou si vous craignez que les pages mises en cache de votre site ne deviennent périmées, il faut lancer le ramasse miettes. Il a lieu régulièrement et supprime les anciens fichiers dans le répertoire du cache. Sur la page des réglages avancés, vous pouvez spécifier :
1. Délai d’attente du cache. Durée pendant laquelle les fichiers du cache sont considérés comme frais. Passé ce délai, ils sont périmés et peuvent être supprimés.
2. Planificateur. Définit la fréquence à laquelle le ramasse miettes doit être lancé.
3. Courriels de notification. Vous pouvez être informé de l’avancement de la tâche du ramasse miettes.
Il n’y a pas de bons ou de mauvais réglages pour le ramasse miettes. Tout dépend du site.
S’il reçoit régulièrement des mises à jour ou des commentaires, réglez le délai d’attente à 1800 secondes et le minuteur à 600 secondes.
Si votre site est principalement statique, vous pouvez désactiver le ramassage des ordures en saisissant 0 comme délai d’attente, ou utiliser une valeur de délai d’attente vraiment grande.

Le répertoire du cache, généralement wp-content/cache/, est réservé aux fichiers temporaires. Ne mettez jamais de fichiers importants ou de liens symboliques vers des fichiers ou des répertoires importants dans ce répertoire. Ils seront supprimés si l’extension y a accès en écriture.

CDN

Un réseau de diffusion de contenu (CDN) est généralement un réseau d’ordinateurs situés dans le monde entier qui sert le contenu de votre site web plus rapidement en utilisant des serveurs proches de vous. Les fichiers statiques tels que les images, les fichiers Javascript et CSS peuvent être servis par ces réseaux afin d’accélérer le chargement de votre site. Vous pouvez également créer un « CDN du pauvre » en utilisant un sous-domaine de votre domaine pour servir des fichiers statiques.

OSSDL CDN off-linker a été intégré à WP Super Cache pour fournir un support CDN de base.Il réécrit les URL des fichiers (à l’exception des fichiers .php) dans wp-content et wp-includes sur votre serveur afin qu’ils pointent vers un nom d’hôte différent. De nombreux CDN prennent en charge la fonctionnalité. origin pull. Cela signifie que le CDN téléchargera automatiquement le fichier à partir de votre serveur lorsqu’il sera demandé pour la première fois, et continuera à le servir pendant une durée configurable avant de le télécharger à nouveau à partir de votre serveur.

Configurez-le dans l’onglet « CDN » de la page des réglages de l’extension. Il s’agit d’une technique avancée qui nécessite des connaissances de base sur le fonctionnement de votre serveur web ou des CDN. Veillez à vider le cache des fichiers après avoir configuré le CDN.

API REST

Il y a maintenant des points de terminaison de l’API REST pour accéder aux réglages de cette extension. Vous aurez besoin d’être authentifié en tant qu’utilisateur admin avec la permission de voir la page des réglages pour l’utiliser. Cela n’a pas encore été documenté, mais vous pouvez trouver tout le code de référence dans le répertoire « rest ».

Custom Caching

Il est désormais possible d’utiliser un point d’accroche dans le processus de mise en cache en utilisant la fonction add_cacheaction().

Trois crochets sont disponibles :

  1. ‘wp_cache_get_cookies_values’ – modify the key used by WP Cache.
  2. ‘add_cacheaction’ – runs in phase2. Allows a plugin to add WordPress hooks.
  3. ‘cache_admin_page’ – runs in the admin page. Use it to modify that page, perhaps by adding new configuration options.

There is one regular WordPress filter too. Use the « do_createsupercache » filter
to customize the checks made before caching. The filter accepts one parameter.
The output of WP-Cache’s wp_cache_get_cookies_values() function.

WP Super Cache a son propre système d’extension. Ce code est chargé lorsque WP Super Cache se charge et peut être utilisé pour modifier la façon dont la mise en cache s’opère. Cela se produit avant que WordPress ne soit chargé. Certaines fonctionnalités peuvent, de ce fait, être indisponibles. Les extensions peuvent se situer à différents endroits où PHP peut les charger. Ajoutez votre propre extension :

  • en plaçant votre extension dans le répertoire « wp-content/plugins/wp-super-cache-plugins », ou
  • by calling wpsc_add_plugin( $name ) where $name is the full filename and path to the plugin. You only need to call that function once to add it. Use wpsc_delete_plugin( $name ) to remove it from the list of loaded plugins.

The cookies WP Super Cache uses to identify « known users » can be modified now by adding the names of those cookies to a list in the plugin configuration. Use wpsc_add_cookie( $name ) to add a new cookie, and wpsc_delete_cookie( $name ) to remove it. The cookie names also modify the mod_rewrite rules used by the plugin but I recommend using Simple mode caching to avoid complications with updating the .htaccess file.
The cookie name and value are used to differenciate users so you can have one cookie, but different values for each type of user on your site for example. They’ll be served different cache files.

See plugins/searchengine.php as an example I use for my No Adverts for Friends plugin.

Dépannage

If things don’t work when you installed the plugin here are a few things to check:

  1. Is wp-content writable by the web server?
  2. Is there a wp-content/wp-cache-config.php ? If not, copy the file wp-super-cache/wp-cache-config-sample.php to wp-content/wp-cache-config.php and make sure WPCACHEHOME points at the right place.
  3. Is there a wp-content/advanced-cache.php ? If not, then you must copy wp-super-cache/advanced-cache.php into wp-content/. You must edit the file and change the path so it points at the wp-super-cache folder.
  4. If pages are not cached at all, remove wp-content/advanced-cache.php and recreate it, following the advice above.
  5. Make sure the following line is in wp-config.php and it is ABOVE the « require_once(ABSPATH.’wp-settings.php’); » line:

    define( 'WP_CACHE', true );
    
  6. Try the Settings->WP Super Cache page again and enable cache.
  7. Look in wp-content/cache/supercache/. Are there directories and files there?
  8. Anything in your php error_log?
  9. If your browser keeps asking you to save the file after the super cache is installed you must disable Super Cache compression. Go to the Settings->WP Super Cache page and disable it there.
  10. The plugin does not work very well when PHP’s safe mode is active. This must be disabled by your administrator.
  11. If pages are randomly super cached and sometimes not, your blog can probably be viewed with and without the « www » prefix on the URL. You should choose one way and install the Enforce www preference plugin if you are using an old WordPress install. The latest versions redirect themselves (you should always be running the latest version of WordPress anyway!)
  12. Private Server users at Dreamhost should edit wp-content/wp-cache-config.php and set the cache dir to « /tmp/ » if they are getting errors about increasing CPU usage. See this discussion for more.
  13. File locking errors such as « failed to acquire key 0x152b: Permission denied in… » or « Page not cached by WP Super Cache. Could not get mutex lock. » are a sign that you may have to use file locking. Edit wp-content/wp-cache-config.php and uncomment « $use_flock = true » or set $sem_id to a different value. You can also disable file locking from the Admin screen as a last resort.
  14. Make sure cache/wp_cache_mutex.lock is writable by the web server if using coarse file locking.
  15. The cache folder cannot be put on an NFS or Samba or NAS share. It has to be on a local disk. File locking and deleting expired files will not work properly unless the cache folder is on the local machine.
  16. Garbage collection of old cache files won’t work if WordPress can’t find wp-cron.php. If your hostname resolves to 127.0.0.1 it could be preventing the garbage collection from working. Check your access_logs for wp-cron.php entries. Do they return a 404 (file not found) or 200 code? If it’s 404 or you don’t see wp-cron.php anywhere WordPress may be looking for that script in the wrong place. You should speak to your server administator to correct this or edit /etc/hosts on Unix servers and remove the following line. Your hostname must resolve to the external IP address other servers on the network/Internet use. See http://yoast.com/wp-cron-issues/ for more. A line like « 127.0.0.1 localhost localhost.localdomain » is ok.

    127.0.0.1 example.com
    
  17. If old pages are being served to your visitors via the supercache, you may be missing Apache modules (or their equivalents if you don’t use Apache). 3 modules are required: mod_mime, mod_headers and mod_expires. The last two are especially important for making sure browsers load new versions of existing pages on your site.
  18. The error message, « WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! » appears at the end of every page. Open the file wp-content/advanced-cache.php in your favourite editor. Is the path to wp-cache-phase1.php correct? This file will normally be in wp-content/plugins/wp-super-cache/. If it is not correct the caching engine will not load.
  19. Caching doesn’t work. The timestamp on my blog keeps changing when I reload. Check that the path in your .htaccess rules matches where the supercache directory is. You may have to hardcode it. Try disabling supercache mode.
  20. If supercache cache files are generated but not served, check the permissions on all your wp-content/cache/supercache folders (and each of wp-content cache and supercache folders) and wp-content/cache/.htaccess. If your PHP runs as a different user to Apache and permissions are strict Apache may not be able to read the PHP generated cache files. To fix you must add the following line to your wp-config.php (Add it above the WP_CACHE define.) Then clear your cache.

    umask( 0022 );
    
  21. If you see garbage in your browser after enabling compression in the plugin, compression may already be enabled in your web server. In Apache you must disable mod_deflate, or in PHP zlib compression may be enabled. You can disable that in three ways. If you have root access, edit your php.ini and find the zlib.output_compression setting and make sure it’s « Off » or add this line to your .htaccess:

    php_flag zlib.output_compression off
    

    If that doesn’t work, add this line to your wp-config.php:

    ini_set('zlib.output_compression', 0);
    
  22. The « white screen of death » or a blank page when you visit your site is almost always caused by a PHP error but it may also be caused by APC. Disable that PHP extension if you have trouble and replace with eAccelerator or Xcache.
  23. After uninstalling, your permalinks may break if you remove the WordPress mod_rewrite rules too. Regenerate those rules by visiting the Settings->Permalink page and saving that form again.
  24. If your blog refuses to load make sure your wp-config.php is correct. Are you missing an opening or closing PHP tag?
  25. Your front …

Installation

Install like any other plugin, directly from your plugins page but make sure you have custom permalinks enabled. Go to the plugin settings page at Settings->WP Super Cache and enable caching.

How to uninstall WP Super Cache

Almost all you have to do is deactivate the plugin on the plugins page. The plugin should clean up most of the files it created and modified, but it doesn’t as yet remove the mod_rewrite rules from the .htaccess file. Look for the section in that file marked by SuperCache BEGIN and END tags. The plugin doesn’t remove those because some people add the WordPress rules in that block too.

To manually uninstall:

  1. Turn off caching on the plugin settings page and clear the cache.
  2. Deactivate the plugin on the plugins page.
  3. Remove the WP_CACHE define from wp-config.php. It looks like define( 'WP_CACHE', true );
  4. Remove the Super Cache mod_rewrite rules from your .htaccess file.
  5. Remove the files wp-content/advanced-cache.php and wp-content/wp-cache-config.php
  6. Remove the directory wp-content/cache/
  7. Remove the directory wp-super-cache from your plugins directory.

If all else fails and your site is broken

  1. Remove the WP_CACHE define from wp-config.php. It looks like define( 'WP_CACHE', true );
  2. Remove the rules (see above) that the plugin wrote to the .htaccess file in your root directory.
  3. Delete the wp-super-cache folder in the plugins folder.
  4. Optionally delete advanced-cache.php, wp-cache-config.php and the cache folder in wp-content/.

FAQ

How do I know my blog is being cached?

Go to Settings -> WP Super Cache and look for the « Cache Tester » form on the easy settings page. Click « Test Cache » and the plugin will request the front page of the site twice, comparing a timestamp on each to make sure they match.

If you want to do it manually, enable debugging in the plugin settings page and load the log file in a new browser tab. Then view your blog while logged in and logged out. You should see activity in the log. View the source of any page on your site. When a page is first created, you’ll see the text « Dynamic page generated in XXXX seconds. » and « Cached page generated by WP-Super-Cache on YYYY-MM-DD HH:MM:SS » at the end of the source code. On reload, a cached page will show the same timestamp so wait a few seconds before checking.
If Supercaching is disabled and you have compression enabled, the text « Compression = gzip » will be added. If compression is disabled and the page is served as a static html file, the text « super cache » will be added. The only other way to check if your cached file was served by PHP script or from the static cache is by looking at the HTTP headers. PHP cached pages will have the header « WP-Super-Cache: Served supercache file from PHP ». WPCache cached files will have the header, « WP-Super-Cache: Served WPCache cache file ». You should also check your cache directory in wp-content/cache/supercache/hostname/ for static cache files.
If the plugin rules are missing from your .htaccess file, the plugin will attempt to serve the super cached page if it’s found. The header « WP-Super-Cache: Served supercache file from PHP » if this happens.
The pagespeed module for Apache may cause problems when testing. Disable it if you notice any problems running the cache tester.

Comment désactiver le Supercaching ?

Si vous ne voulez utiliser que le moteur WP-Cache, modifiez votre wp-config.php ou créez une extension indispensable qui fixe la constante « DISABLE_SUPERCACHE » à 1.

Fichiers WP-Cache vs Supercache

Tous les fichiers de cache sont stockés dans wp-content/cache/supercache/HOSTNAME/ où HOSTNANE est votre nom de domaine. Les fichiers sont stockés dans des répertoires correspondant à la structure de permalien de votre site. Les fichiers Supercache sont index.html ou une variante de celui-ci, en fonction du type de visiteur qui a accédé au site. Les autres fichiers sont nommés wp-cache-XXXXXXXXXXXXXXXXX.php. Les noms des fichiers méta associés commencent par « meta ». Ces fichiers contiennent des informations sur le fichier mis en cache. Ces fichiers sont générés par le moteur « WPCache caching » de l’extension.

Will comments and other dynamic parts of my blog update immediately?

Comments will show as soon as they are moderated, depending on the comment policy of the blog owner. Other dynamic elements on a page may not update unless they are written in Javascript, Flash, Java or another client side browser language. The plugin really produces static html pages. No PHP is executed when those pages are served. « Popularity Contest » is one such plugin that will not work.

Will the Super Cache compression slow down my server?

No, it will do the opposite. Super Cache files are compressed and stored that way so the heavy compression is done only once. These files are generally much smaller and are sent to a visitor’s browser much more quickly than uncompressed html. As a result, your server spends less time talking over the network which saves CPU time and bandwidth, and can also serve the next request much more quickly.

How do I make certain parts of the page stay dynamic?

Note: this functionality is disabled by default. You will have to enable it on the Advanced Settings page.

There are 2 ways of doing this. You can use Javascript to draw the part of the page you want to keep dynamic. That’s what Google Adsense and many widgets from external sites do and is the recommended way. Or you can use a WP Super Cache filter to do the job but you can’t use mod_rewrite mode caching. You have to use the « simple » delivery method or disable supercaching.

WP Super Cache 1.4 introduced a cacheaction filter called wpsc_cachedata. The cached page to be displayed goes through this filter and allows modification of the page. If the page contains a placeholder tag the filter can be used to replace that tag with your dynamically generated html.
The function that hooks on to the wpsc_cachedata filter should be put in a file in the WP Super Cache plugins folder unless you use the late_init feature. An example plugin is included. Edit dynamic-cache-test.php to see the example code.
There are two example functions there. There’s a simple function that replaces a string (or tag) you define when the cached page is served. The other example function uses an output buffer to generate the dynamic content. Due to a limitation in how PHP works the output buffer code MUST run before the wpsc_cachedata filter is hit, at least for when a page is cached. It doesn’t matter when serving cached pages. See this post for a more technical and longer explanation.
To execute WordPress functions you must enable the ‘Late init’ feature on the advanced settings page.

How do I delay serving the cache until the « init » action fires?

Cached files are served before almost all of WordPress is loaded. While that’s great for performance it’s a pain when you want to extend the plugin using a core part of WordPress. Enable ‘Late init’ mode on the Advanced settings page and cached files will be served when « init » fires. WordPress and it’s plugins will be loaded now.

Why don’t WP UserOnline, Popularity Contest, WP Postratings or plugin X not work or update on my blog now?

This plugin caches entire pages but some plugins think they can run PHP code every time a page loads. To fix this, the plugin needs to use Javascript/AJAX methods or the wpsc_cachedata filter described in the previous answer to update or display dynamic information.

Why do my WP Super Cache plugins disappear when I upgrade the plugin?

WordPress deletes the plugin folder when it updates a plugin. This is the same with WP Super Cache so any modified files in wp-super-cache/plugins/ will be deleted. You can put your custom plugins in a different directory in a number of ways. You can define the variable $wp_cache_plugins_dir in wp-config.php or wp-content/wp-cache-config.php and point it at a directory outside of the wp-super-cache folder. The plugin will look there for it’s plugins. Or if you distribute a plugin that needs to load early you can use the function wpsc_add_plugin( $filename ) to add a new plugin wherever it may be. Use wpsc_delete_plugin( $filename ) to remove the plugin file. See #574 or this post on writing WP Super Cache plugins.

What does the Cache Rebuild feature do?

When a visitor leaves a comment the cached file for that page is deleted and the next visitor recreates the cached page. A page takes time to load so what happens if it receives 100 visitors during this time? There won’t be a cached page so WordPress will serve a fresh page for each user and the plugin will try to create a cached page for each of those 100 visitors causing a huge load on your server. This feature stops this happening. The cached page is not cleared when a comment is left. It is marked for rebuilding instead. The next visitor within the next 10 seconds will regenerate the cached page while the old page is served to the other 99 visitors. The page is eventually loaded by the first visitor and the cached page updated. See this post for more.

Why doesn’t the plugin cache requests by search engine bots by default?

Those bots usually only visit each page once and if the page is not popular there’s no point creating a cache file that will sit idle on your server. However you can allow these visits to be cached by removing the list of bots from « Rejected User Agents » on the Advanced settings page.

A category page is showing instead of my homepage

A tiny proportion of websites will have problems with the following configuration:

  1. Uses a static page for the front page.
  2. Uses /%category%/%postname%/ permalink structure.

Il arrive qu’une page de catégorie soit mise en cache en tant que page d’accueil du site au lieu d’une page statique. Je ne peux pas reproduire le problème mais une solution simple consiste à utiliser le mode « Simple ». Vous pouvez également activer l’option « Vérifications supplémentaires de la page d’accueil » sur la page des réglages avancés.

Why do I get warnings about caching from http://ismyblogworking.com/

« Your blog doesn’t support client caching (no 304 response to If-modified-since). »
« Your feed doesn’t support caching (no 304 response to If-modified-since) »

Supercache doesn’t support 304 header checks in Expert mode but does support it in Simple mode. This is caching done by your browser, not the server. It is a check your browser does to ask the server if an updated version of the current page is available. If not, it doesn’t download the old version again. The page is still cached by your server, just not by your visitors’ browsers.
Try the Cacheability Engine at http://www.ircache.net/cgi-bin/cacheability.py or https://redbot.org/ for further analysis.

How should I best use the utm_source tracking tools in Google Analytics with this plugin?

That tracking adds a query string to each url linked from various sources like Twitter and feedreaders. Unfortunately it stops pages being supercached. See Joost’s comment here for how to turn it into an anchor tag which can be supercached.

The plugin complains that wp-content is writable! htdocs is writable!

It’s not good when the web server can write to these directories but sometimes shared hosting accounts are set up in this way to make administration easier. Use chmod 755 directory to fix the permissions or find the permissions section of your ftp client. This Google search will lead you to more information on this topic and there’s also this codex page too. Unfortunately some hosts require that those directories be writable. If that’s the case just ignore this warning.

How do I delete the WP_CACHE define from wp-config.php?

Load your desktop ftp client and connect to your site. Navigate to the root (or the directory below it) of your site where you’ll find wp-config.php. Download that file and edit it in a text editor. Delete the line define( 'WP_CACHE', true ); and save the file. Now upload it, overwriting the wp-config.php on your server.

How do I delete the Super Cache rules from the .htaccess file?

Load your desktop ftp client and connect to your site. You may need to enable « Show hidden files » in the preferences of the ftp client. Navigate to the root of your site where you’ll find the .htaccess file. Download that file and edit it in a text editor. Delete the lines between « # BEGIN WPSuperCache » and « # END WPSuperCache » and save the file. Now upload it, overwriting the .htaccess file on your server.

How do I change file permissions?

This page on the WordPress Codex explains everything you need to know about file permissions on your server and various ways of changing them.

Why do I get load spikes when new posts are made?

You may have the « clear all cached files when new posts are made » option set. Clearing those files can take time plus your visitors will now be visiting uncached pages. Are you using Google Analytics campaign tracking with utm_source in the url? Those pages aren’t cached. See the question, « How should I best use the utm_source tracking tools in Google Analytics with this plugin » above for how to use them properly.
Cached pages have to be refreshed when posts are made. Perhaps your server just isn’t up to the job of serving the amount of traffic you get. Enable the « cache rebuild » feature as that may help.

How many pages can I cache?

The only real limit are limits defined by your server. For example, EXT2 and EXT3 allow a maximum of 31,999 sub directories so if you have a flat permalink structure (like /%POSTNAME%/) and more than 32,000 posts you may run into problems. Likewise, if you run a multisite network and have more than 31,999 sites (blogs) you won’t be able to cache all of them. Realistically if you had that many active sites you wouldn’t be running on one server.

Je constate que la version www de mon site est mise en cache séparément. Comment puis-je arrêter cela ?

WordPress should redirect to the canonical URL of your site but if it doesn’t, add this to your .htaccess above the Supercache and WordPress rules. Change example.com to your own hostname.
RewriteCond %{HTTP_HOST} www.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]

How do I serve cached mobile pages to clients on small screens like phones and tablets?

Your theme is probably responsive which means it resizes the page to suit whatever device is displaying the page. If it’s not responsive, you’ll have to use a separate mobile plugin to render a page formatted for those visitors. The following plugins have been tested but YMMV depending on mobile client. You’ll have to enable mobile browser support as well on the Advanced settings page.

Avis

17 mars 2024 1 réponse
A simple and powerful extension that remarkably improves the speed of my site. I recommend it to wordpress site developers.
7 janvier 2024 1 réponse
Hello, the cache preload function works fine, after preload all pages it seems to delete the cache and start over. I want the cache to be cleared only on page and product updates. How can I solve this problem please help.
21 décembre 2023 1 réponse
I have used this plugin for ages and never had a problem. I cleaned a site up that had malware and it was fine. After reinstalling all plugins I get redirect malware which wants to redirect my users to a "catsndogz.org" site which is infected with a "botnet" malware. Thanks god I have anti virus software running on my pc. I uninstalled this plugin and ran the antivirus plugin on my wordpress site and malware is gone. Don't know if is this plugin but will investigate further but meanwhile please be aware.
7 novembre 2023 2 réponses
Overall, it's a really great and simple to configure caching plugin. What I really like about WP Super Cache, is that it allows you to dive deeper and configure everything how you like. It even allows you to bypass the PHP request processing and just use .htaccess or nginx config rules to more efficiently cache & deliver content.
Lire les 1 327 avis

Contributeurs/contributrices & développeurs/développeuses

« WP Super Cache » est un logiciel libre. Les personnes suivantes ont contribué à cette extension.

Contributeurs

“WP Super Cache” a été traduit dans 31 locales. Remerciez l’équipe de traduction pour ses contributions.

Traduisez « WP Super Cache » dans votre langue.

Le développement vous intéresse ?

Parcourir le code, consulter le SVN dépôt, ou s’inscrire au journal de développement par RSS.

Journal

1.12.0 – 2024-03-11

Added

  • Setup: Detect Jetpack Boost cache and suggest troubleshooting steps
  • WP Super Cache: added WPSC_PRELOAD_POST_INTERVAL and WPSC_PRELOAD_LOOP_INTERVAL to modify preload timings

Changed

  • Code Modernization: Replace usage of strpos() with str_contains()
  • Code Modernization: Replace usage of strpos() with str_starts_with().
  • Code Modernization: Replace usage of substr() with str_starts_with() and str_ends_with().
  • Fix blurry Automattic logo.
  • General: avoid deprecation warnings when trying to get URLs in PHP 8.2
  • General: indicate compatibility with the upcoming version of WordPress, 6.5.
  • General: updated PHP requirement to PHP 7.0+
  • General: update WordPress version requirements to WordPress 6.3.
  • WP Super Cache: check for Boost Cache when creating advanced-cache.php
  • WP Super Cache: fixed labels on advanced settings page
  • WP Super Cache: remove notifications that preload started working again.

Fixed

  • Supercache: add « days » to « Next preload scheduled » message.
  • Super Cache: with rebuild enabled, apply that to subdirectories instead of deleting them.
  • WP Super Cache – fix the wp_super_cache_clear_post_cache filter so the homepage cache isn’t deleted too.
  • WP Super Cache: bail if the request uri isn’t set. It means the plugin isn’t configured yet.
  • WP Super Cache: don’t create an output buffer if there’s already one active
  • WP Super Cache: fixed serving a cached page on POST with late init enabled.
  • WP Super Cache: fix the output buffer check, and make debug logs pre-formatted.
  • WP Super Cache: if the preload number of posts is not in the list, then add it

See the previous changelogs here