WP Super Cache

描述

该插件可以从您的动态WordPress博客中生成静态html文件。 生成html文件后,您的WEB服务器将直接使用html文件来提供服务,而无需处理相对较臃肿和昂贵的WordPress PHP脚本。

静态html文件将提供给绝大多数用户:

  • 未登录的用户。
  • 没有在您的博客上留下评论的用户。
  • 或者没有查看过密码保护文章的用户。

99% of your visitors will be served static html files. One cached file can be served thousands of times. Other visitors will be served custom cached files tailored to their visit. If they are logged in, or have left comments those details will be displayed and cached for them.

该插件以3种方式提供缓存文件(按速度排序)。

  1. 专家。最快的方法是使用Apache mod_rewrite(或您的web服务器支持的任何类似模块)来提供 “超级缓存 “静态html文件。这些方法完全绕过了PHP,且速度飞快。如果您的服务器受到大量的流量冲击,也可以很容易的应对,因为请求是 “轻量级 “的。需要Apache mod_rewrite模块(如果您设置有自定义的固定链接,则该模块可能已经安装)并预先修改了您的.htaccess文件,这些修改势必会存在一些风险,如果修改不正确,则可能会使您的站点瘫痪。
  2. Simple. Supercached static files can be served by PHP and this is the recommended way of using the plugin. The plugin will serve a “supercached” file if it exists and it’s almost as fast as the mod_rewrite method. It’s easier to configure as the .htaccess file doesn’t need to be changed. You still need a custom permalink. You can keep portions of your page dynamic in this caching mode.
  3. WP-Cache caching. This is mainly used to cache pages for known users, URLs with parameters and feeds. Known users are logged in users, visitors who leave comments or those who should be shown custom per-user data. It’s the most flexible caching method and slightly slower. WP-Cache caching will also cache visits by unknown users if supercaching is disabled. You can have dynamic parts to your page in this mode too. This mode is always enabled but you can disable caching for known users, URLs with parameters, or feeds separately. Set the constant “DISABLE_SUPERCACHE” to 1 in your wp-config.php if you want to only use WP-Cache caching.

If you’re not comfortable with editing PHP files then use simple mode. It’s easy to set up and very fast.

推荐设置

  1. 简单的缓存。
  2. 压缩页面。
  3. 不缓存已知用户的页面。
  4. 缓存重建。
  5. CDN支持。
  6. 额外的主页检查。

Garbage collection is the act of cleaning up cache files that are out of date and stale. There’s no correct value for the expiry time but a good starting point is 1800 seconds.

Consider deleting the contents of the “Rejected User Agents” text box and allow search engines to cache files for you.

Preload as many posts as you can and enable “Preload Mode”. Garbage collection of old cached files will be disabled. If you don’t care about sidebar widgets updating often set the preload interval to 2880 minutes (2 days) so all your posts aren’t recached very often. When the preload occurs the cache files for the post being refreshed is deleted and then regenerated. Afterwards a garbage collection of all old files is performed to clean out stale cache files.
Even with preload mode enabled cached files will still be deleted when posts are modified or comments made.

开发

  • Active development of this plugin is handled on GitHub.
  • Translation of the plugin into different languages is on the translation page.

文档

If you need more information than the following, you can have a look at the wiki or the Developer documentation.

预加载

You can generate cached files for the posts, categories and tags of your site by preloading. Preloading will visit each page of your site generating a cached page as it goes along, just like any other visitor to the site. Due to the sequential nature of this function, it can take some time to preload a complete site if there are many posts.
To make preloading more effective it can be useful to disable garbage collection so that older cache files are not deleted. This is done by enabling “Preload Mode” in the settings. Be aware however, that pages will go out of date eventually but that updates by submitting comments or editing posts will clear portions of the cache.

垃圾收集

Your cache directory fills up over time, which takes up space on your server. If space is limited or billed by capacity, or if you worry that the cached pages of your site will go stale then garbage collection has to be done. Garbage collection happens on a regular basis and deletes old files in the cache directory. On the advanced settings page you can specify:
1. Cache timeout. How long cache files are considered fresh for. After this time they are stale and can be deleted.
2. Scheduler. Setup how often garbage collection should be done.
3. Notification emails. You can be informed on garbage collection job progress.
There’s no right or wrong settings for garbage collection. It depends on your own site.
If your site gets regular updates, or comments then set the timeout to 1800 seconds, and set the timer to 600 seconds.
If your site is mostly static you can disable garbage collection by entering 0 as the timeout, or use a really large timeout value.

缓存目录,通常是wp-content/cache/只用于存放临时文件。切勿将重要的文件或重要文件或目录的符号链接放在该目录中。如果插件对该目录有写访问权限,则该目录中的所有内容都会被删除。

CDN(内容分发网络)

A Content Delivery Network (CDN) is usually a network of computers situated around the world that will serve the content of your website faster by using servers close to you. Static files like images, Javascript and CSS files can be served through these networks to speed up how fast your site loads. You can also create a “poor man’s CDN” by using a sub domain of your domain to serve static files too.

OSSDL CDN off-linker has been integrated into WP Super Cache to provide basic CDN support. It works by rewriting the URLs of files (excluding .php files) in wp-content and wp-includes on your server so they point at a different hostname. Many CDNs support origin pull. This means the CDN will download the file automatically from your server when it’s first requested, and will continue to serve it for a configurable length of time before downloading it again from your server.

Configure this on the “CDN” tab of the plugin settings page. This is an advanced technique and requires a basic understanding of how your webserver or CDNs work. Please be sure to clear the file cache after you configure the CDN.

REST API

There are now REST API endpoints for accessing the settings of this plugin. You’ll need to be authenticated as an admin user with permission to view the settings page to use it. This has not been documented yet but you can find all the code that deals with this in the “rest” directory.

自定义缓存

It is now possible to hook into the caching process using the add_cacheaction() function.

三个钩子(hooks)可用:

  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 具有自己的插件系统。 加载 WP Super Cache 时将加载此代码,并且可用于更改缓存的方式。 这是在大多数 WordPress 加载之前,因此某些功能将不可用。 插件可以位于 PHP 可以加载它们的任何位置。 添加您自己的插件:

  • 通过将插件放在 wp-content/plugins/wp-super-cache-plugins 目录中,或
  • 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.

故障排除

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

  1. wp-content是否可以被Web服务器写入?
  2. 是否存在wp-content/wp-cache-config.php?如果否,请将wp-super-cache/wp-cache-config-sample.php文件复制到wp-content/wp-cache-config.php中,并确保WPCACHEHOME指向正确的位置。
  3. 是否有wp-content/advanced-cache.php?如果没有,那么你必须将wp-super-cache/advanced-cache.php复制到wp-content/。你必须编辑该文件并更改路径,使其指向wp-super-cache文件夹。
  4. 如果页面没有被缓存,请删除wp-content/advanced-cache.php,然后按照上面的建议重新创建。
  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. 尝试转到设置->超级缓存页面,启用缓存。
  7. 查看wp-content/cache/supercache/。是否存在目录和文件?
  8. 您的php error_log中有什么内容吗?
  9. 如果您的浏览器在安装超级缓存后一直要求保存文件,则需要禁用超级缓存压缩。进入设置->超级缓存页面,然后在将其禁用。
  10. 当PHP的安全模式启用时,该插件无法发挥最佳性能运行。您的管理员必须禁用该功能。
  11. 如果页面的缓存有时是随机的,而有时不是,则您的博客可能可以通过带和不带”www”前缀的两种方式进行预览。您应该选择一种方式,并安装Enforce www preference插件,如果您使用的是旧版的WordPress安装。则最新版本的WordPress会自己重定向(无论如何,您都应该运行最新版本的WordPress!)。
  12. Dreamhost 私有服务器的用户如果收到关于增加CPU使用量的错误信息,则应该编辑 wp-content/wp-cache-config.php,并将缓存目录设置为”/tmp/”。更多内容请参阅此讨论
  13. 文件锁定错误,例如“无法获取密钥0x152b:权限被拒绝…”或“ WP Super Cache未缓存页面。无法获取mutex锁”。这表明您可能需要使用文件锁定。编辑wp-content / wp-cache-config.php并取消“ $ use_flock = true”的注释或将$ sem_id设置为其他值。最后,您还可以从“管理”页面禁用文件锁定。
  14. 如果使用粗略的文件锁定,请确保cache/wp_cache_mutex.lock可以被Web服务器写入。
  15. 缓存文件夹不能放在NFS或Samba或NAS共享上。其必须在本地磁盘上。除非缓存文件夹位于本地计算机,否则文件锁定和删除过期文件将无法正常运作。
  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. 如果通过超级缓存向您的访问者提供服务的是旧页面,则您可能缺少Apache模块(如果您不使用Apache,则有可能缺少的是其等效模块)。需要这3个模块:mod_mime、mod_headers和mod_expires。最后两个模块对于确保浏览器加载您站点的现有页面的最新版本尤为重要。
  18. 错误信息:”WP Super Cache已安装,但已损坏。wp-content/advanced-cache.php中wp-cache-phase1.php的路径需要修复!”,如果以上错误信息出现在每个页面的最末。可以用您喜欢的编辑器打开wp-content/advanced-cache.php文件。查看wp-cache-phase1.php的路径是否正确?这个文件通常在wp-content/plugins/wp-super-cache/中。如果路径不正确,缓存引擎将无法加载。
  19. 缓存不起作用。重新加载时,博客上的时间戳不断变化。检查.htaccess规则中的路径是否与supercache目录所在的位置匹配。您可能需要对其进行硬编码。尝试禁用超级缓存模式。
  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. 当您访问您的站点时,”白屏 “或空白页几乎都是由PHP错误引起的,但也有可能是由APC引起的。如果存在问题,请禁用该PHP扩展,并用eAccelerator或Xcache扩展代替。
  23. 在卸载之后,如果您也删除了WordPress的mod_rewrite规则,您的固定链接可能会被破坏。通过访问 “设置”->”固定链接 “页面并再次保存该表单来重新生成这些规则。
  24. 如果您的博客无法加载,请确认wp-config.php文件内容是否正确。是否缺少开头或结尾的PHP标签?
  25. 您的首页没问题,但文章和页面却显示404?转到 “设置”->”固定链接”,选择好自定义固定链接结构后,点击 “保存”。您可能需要手动更新您的.htaccess文件。
  26. If certain characters do not appear correctly on your website your server may not be configured correctly. You need to tell visitors what character set is used. Go to Settings->Reading and copy the ‘Encoding for pages and feeds’ value. Edit the .htaccess file with all your Supercache and WordPress rewrite rules and add this at the top, replacing CHARSET with the copied value. (for example, ‘UTF-8’)

    AddDefaultCharset CHARSET
    
  27. Use Cron View to help diagnose garbage collection and preload problems. Use the plugin to make sure jobs are scheduled and for what time. Look for the wp_cache_gc and wp_cache_full_preload_hook jobs.
  28. 错误消息:”WP Super Cache已安装但已损坏。常量WPCACHEHOME必须在wp-config.php文件中设置,并指向WP Super Cache插件的目录。”如果已上消息出现在每个页面的最末。您可以删除wp-content/advanced-cache.php并重新加载插件设置页面,或者编辑wp-config.php并查找WPCACHEHOME确保其指向wp-super-cache文件夹。该路径通常是wp-content/plugins/wp-super-cache/,但您可能需要该文件的完整路径(这样可以简单的通过设置页面将其修复)。如果路径不正确,缓存引擎将无法加载。
  29. If your server is running into trouble because of the number of semaphores used by the plugin it’s because your users are using file locking which is not recommended (but is needed by a small number of users). You can globally disable file locking by defining the constant WPSC_DISABLE_LOCKING, or defining the constant WPSC_REMOVE_SEMAPHORE so that sem_remove() is called after every page is cached but that seems to cause problems for other processes requesting the same semaphore. Best to disable it.
  30. Set the variable $htaccess_path in wp-config.php or wp-cache-config.php to the path of your global .htaccess if the plugin is looking for that file in the wrong directory. This might happen if you have WordPress installed in an unusual way.

安装

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.

如何卸载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.

手动卸载:

  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. 删除这个目录 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/.

常见问题

我怎么知道我的博客被缓存了?

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.

如何禁用超级缓存?

If you only want to use the WP-Cache engine then edit your wp-config.php or create an mu-plugin that sets the constant ‘DISABLE_SUPERCACHE’ to 1.

WP-Cache vs Supercache files

All cache files are stored in wp-content/cache/supercache/HOSTNAME/ where HOSTNANE is your domain name. The files are stored in directories matching your site’s permalink structure. Supercache files are index.html or some variant of that, depending on what type of visitor hit the blog. Other files are named wp-cache-XXXXXXXXXXXXXXXXX.php. Associated meta filesnames start with “meta”. Those files contain information about the cached file. These files are generated by the “WPCache caching” engine in the plugin.

我博客的评论和其他动态的部分会立即更新吗?

根据博客所有者的评论政策,评论一旦经过审核就会公开显示。页面上的其他动态元素可能不会更新,除非这些网页是用Javascript、Flash、Java或其他客户端浏览器语言编写的。该插件真正生成的是静态html页面。当这些页面用于向访问者提供服务时,PHP不会被执行。例如”Popularity Contest”就是这样一个无法运作的插件。

超级缓存压缩会减慢我的服务器速度吗?

不,正好相反。超级缓存文件是以此种方式压缩和存储的,所以强力压缩只需要执行一次。这些文件通常非常小,并可以比未压缩的html更快地发送到访问者的浏览器中。因此,您的服务器花在WEB上的时间请求更少,从而节省了CPU时间和带宽,也可以更快地服务于下一个请求。

如何使页面的某些部分保持动态?

注:该功能默认为禁用。您必须在 “高级设置 “页面将其启用。

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.

如何延迟服务缓存直到触发“init”操作?

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.

为什么我的博客现在不能使用或更新WP UserOnline, Popularity Contest, WP Postratings或某插件?

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.

为什么我升级插件时超级缓存插件会消失?

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.

缓存重建功能有什么作用?

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.

为什么插件默认不缓存搜索引擎蜘蛛的请求?

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 tiny proportion of websites will have problems with the following configuration:

  1. 使用静态页面作为首页。
  2. 可以使用”/%category%/%postname%/ permalink”的固定链接形式。

Sometimes a category page is cached as the homepage of the site instead of the static page. I can’t replicate the problem but a simple solution is to use the “Simple” mode. You can also enable “Extra homepage checks” on the Advanced Settings page.

为什么我收到来自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.

我应如何通过此插件充分使用Google Analytics中的utm_source跟踪工具?

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.

插件警告wp-content是可写的!Htdocs是可写的!

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.

如何删除wp-config.php中定义的WP_CACHE常量?

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.

如何从.htaccess文件中删除超级缓存规则?

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.

如何更改文件权限?

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

为什么我在撰写文章的时候会显示负载过高?

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.

我可以缓存多少页面?

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.

我可以看到我网站的 www 版本是单独缓存的。 如何停止呢?

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]

如何在手机、平板电脑等小屏幕上为客户提供缓存的移动版页面?

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.

评价

2023年5月12日 1 回复
I don't normally rate plugins, but this plugin provoked me into giving this rating. If you install this plugin be ready to have errors on your site especially if you decide to uninstall it. The plugin will send you emails asking you to start manually digging into files to delete some stubborn craps that refused to go during the uninstall. Normally, I would expect everything to be just fine after the uninstall, but this plugin will ask you to manually start deleting files it created, and start referring you to read-up long documentation to proceed. I find this annoying. If you are comfortable with this, you can go ahead and use the plugin.
2023年2月28日 3 回复
All is in the title, please help me ...I already tried Redis plugin but I had cron problems lol.How can we activate the persistent object cache in WP Super Cache ? I'm bored to install and try tons of plugins to get my WP running like a charm without health alerts.Thanks in advance.
2023年2月16日 3 回复
My website actually runs slower after installing this "WP Super cache" Edited review to reflect the fact that the problem was with Mailchimp for Woocommerce with which it seems to be incompatible - or at least doesnt speed up page loads if that is active.
2023年2月4日 1 回复
It's missing automatic preload of cache upon content change. That makes it not right solution in many cases unfortunately
阅读所有1,308条评价

贡献者及开发者

“WP Super Cache” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

“WP Super Cache”插件已被翻译至30种本地话语言。 感谢所有译者为本插件所做的贡献。

将“WP Super Cache”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

1.9.4-beta – 2023-03-02

Added

  • Added a check to ensure preload cronjobs exist when updating preload settings.
  • Added new filter which controls cache clearing on post edit.

Changed

  • Updated contributors list.

Fixed

  • Fixed deprecation warnings on PHP 8.1+.
  • Fixed undefined PHP variable when trying to delete a protected folder.

See the previous changelogs here