server Latest Entries

AJAX Cache Purge Cookie Plugin

This plugin sets a “version” cookie of your site’s content, which can be used for time-based cache invalidation, as the cookie is checked and updated (if necessary) on each page request through a single AJAX request.

Download: ajax-cache-purge.zip (June 26, 2010)

Installation

Please note that this plugin is intended for people who run their own servers.

  1. Upload and enable the plugin.
  2. Add the value of wp_cache_key_cookie to the cache key.

Nginx Example

fastcgi_cache_path 	/var/www/cache  levels=1:2
			keys_zone=wp-cache:10m
			inactive=2m max_size=2000m;

fastcgi_temp_path 	/var/www/cache/tmp;

server {
	# other config options

	location ~ \.php$ {
		# wp_cache_key_cookie is supplied by the plugin
		set $wp_cache_key $scheme$host$request_uri|$cookie_wp_cache_key_cookie;

		#add key in header for debugging
		#add_header	WP_KEY $wp_cache_key;

		fastcgi_cache 		wp-cache;
		fastcgi_cache_key 	$wp_cache_key;
	}
}

Remove index.html from the URL

Some servers seem to automatically append index.html to all HTTP requests, which you can remove by placing this at the beginning of .htaccess:

RewriteEngine On # remove this, if you have it already

RewriteCond %{REQUEST_URI} index\.html
RewriteRule ^(.*)index\.html$ /$1/ [R=301,L]

I used this technique for a site that I built — ichomesforsale.com which is hosted at Godaddy.