wp-super-cache
Last commit date
plugins
18 years ago
Changelog.txt
18 years ago
readme.txt
18 years ago
wp-cache-base.php
18 years ago
wp-cache-config-sample.php
18 years ago
wp-cache-phase1.php
18 years ago
wp-cache-phase2.php
18 years ago
wp-cache.php
18 years ago
readme.txt
93 lines
| 1 | === WP Super Cache === |
| 2 | Contributors: donncha |
| 3 | Tags: performance,caching,wp-cache |
| 4 | Tested up to: 2.3.1 |
| 5 | Stable tag: 0.5.2 |
| 6 | |
| 7 | A modification of WP-Cache that produces static html files. |
| 8 | |
| 9 | == Description == |
| 10 | This plugin generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts. |
| 11 | |
| 12 | However, because a user's details are displayed in the comment form after they leave a comment, the plugin will only serve static html files to: |
| 13 | |
| 14 | 1. Users who are not logged in. |
| 15 | 2. Users who have not left a comment on your blog. |
| 16 | 3. Or users who have not viewed a password protected post. |
| 17 | |
| 18 | The good news is that probably more than 99% of your visitors don't do any of the above! Those users who don't see the static files will still benefit because they will see regular WP-Cache cached files and your server won't be as busy as before. This plugin should help your server cope with a front page appearance on digg.com or other social networking site. |
| 19 | |
| 20 | == Installation == |
| 21 | 1. You must have mod mime, mod rewrite and fancy permalinks enabled. PHP safe mode should be disabled. |
| 22 | 2. If you have WP-Cache installed already, please disable it. Edit wp-config.php and make sure the WP_CACHE define is deleted, and remove the files wp-content/wp-cache-config.php and wp-content/advanced-cache.php. These will be recreated when you install this plugin. |
| 23 | 3. Upload this directory to your plugins directory. It will create a 'wp-content/plugins/wp-super-cache/' directory. |
| 24 | 4. If you are using WordPress MU you will need to install this in 'wp-content/mu-plugins/wp-super-cache/' and the file wp-cache.php must be copied into the mu-plugins directory. |
| 25 | 5. WordPress users should go to their Plugins page and activate "WP Super Cache". |
| 26 | 6. Now go to Options->WP Super Cache and enable caching. If you see an error message or a blank screen you may need to fix it. See the "FAQ" section later in this readme for instructions. |
| 27 | 7. mod_rewrite rules will be inserted into your .htaccess file. Look in your web root directory for this file. It should look similar to this: |
| 28 | |
| 29 | -----------------.htaccess----------------- |
| 30 | RewriteEngine On |
| 31 | RewriteBase / |
| 32 | |
| 33 | RewriteCond %{QUERY_STRING} !.*s=.* |
| 34 | RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$ |
| 35 | RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$ |
| 36 | RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$ |
| 37 | RewriteCond %{HTTP:Accept-Encoding} gzip |
| 38 | RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz -f |
| 39 | RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz [L] |
| 40 | |
| 41 | RewriteCond %{QUERY_STRING} !.*s=.* |
| 42 | RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$ |
| 43 | RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$ |
| 44 | RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$ |
| 45 | RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.html -f |
| 46 | RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html [L] |
| 47 | |
| 48 | RewriteCond %{REQUEST_FILENAME} !-f |
| 49 | RewriteCond %{REQUEST_FILENAME} !-d |
| 50 | RewriteRule . /index.php [L] |
| 51 | -----------------.htaccess----------------- |
| 52 | 8. After you have enabled the plugin, look for "wp-content/cache/.htaccess". If it's not there you must create it. It should read: |
| 53 | AddEncoding x-gzip .gz |
| 54 | AddType text/html .gz |
| 55 | |
| 56 | == Frequently Asked Questions == |
| 57 | If things don't work when you installed the plugin here are a few things to check: |
| 58 | |
| 59 | 1. Is wp-content writable by the web server? |
| 60 | 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. "plugins" should be "mu-plugins" if you're using WordPress MU. |
| 61 | 3. Is there a wp-content/advanced-cache.php ? If not, then you must symlink wp-super-cache/wp-cache-phase1.php to it with the command while in the wp-content folder. `ln -s plugins/wp-super-cache/wp-cache-phase1.php advanced-cache.php` If you can't do that, then copy the file. That will work too. |
| 62 | 4. Make sure the following line is in wp-config.php : `define( 'WP_CACHE', true );` |
| 63 | 5. Try the Options->WP Super Cache page again and enable cache. |
| 64 | 6. Look in wp-content/cache/supercache/. Are there directories and files there? |
| 65 | 7. Anything in your php error_log? |
| 66 | 8. 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 Options->WP Super Cache page and disable it there. |
| 67 | 9. The plugin does not work very well when PHP's safe mode is active. This must be disabled by your administrator. |
| 68 | |
| 69 | == Custom Caching == |
| 70 | It is now possible to hook into the caching process using the add_cacheacton() function. |
| 71 | Three hooks are available: |
| 72 | |
| 73 | 1. 'wp_cache_get_cookies_values' - modify the key used by WP Cache. |
| 74 | 2. 'add_cacheaction' - runs in phase2. Allows a plugin to add WordPress hooks. |
| 75 | 3. 'cache_admin_page' - runs in the admin page. Use it to add modify that page. |
| 76 | |
| 77 | There is one regular WordPress filter too. Use the "do_createsupercache" filter |
| 78 | to customize the checks made before caching. The filter accepts one parameter. |
| 79 | The output of WP-Cache's wp_cache_get_cookies_values() function. |
| 80 | |
| 81 | See plugins/searchengine.php as an example I use for my [No Adverts for Friends](plugin at http://ocaoimh.ie/no-adverts-for-friends/) |
| 82 | |
| 83 | == Updates == |
| 84 | Updates to the plugin will be posted here, to http://ocaoimh.ie/ and the page |
| 85 | http://ocaoimh.ie/wp-super-cache/ will always link to the newest version. |
| 86 | |
| 87 | == Thanks == |
| 88 | I would sincerely like to thank [John Pozadzides](http://onemansblog.com/) for |
| 89 | giving me the idea for this, for writing the "How it works" section and for |
| 90 | testing the plugin through 2 front page appearances on digg.com |
| 91 | Thanks to James Farmer and Andrew Billits of [Edu Blogs](http://edublogs.org/) fame who helped me |
| 92 | make this more WordPress MU friendly. |
| 93 |