Elliott C. Back: Internet & Technology

WP SuperCache .htaccess mod_rewrite rules for Blogs in Subdomains/Subdirectories

Posted in Code, Mod_Rewrite, WP, Wordpress by Elliott Back on June 8th, 2009.

I have a unique problem, which is that I have installed my wordpress to a subdirectory, and symlinked httpdocs from several subdomains to that directory. The structure looks like this:

httpdocs/wp/ -> WP Install
subdomains/gadgets/httpdocs/ -> /elliottback.com/httpdocs/wp/
subdomains/books/httpdocs/ -> /elliottback.com/httpdocs/wp/

This means that from my domain, we’re always sticking an extra /wp onto things, but from the subdomains, they go directly into the wp-content directories from the root , in both relative and absolute sense. I consolidated my subdomains this way so that I could run a single WP install and maintain them together. Here’s the .htaccess file that lets WP Super Cache work on either of them:

# BEGIN WPSuperCache
<ifmodule mod_rewrite.c>
RewriteEngine On
AddDefaultCharset UTF-8
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_URI} ^(/wp)?/
RewriteCond %{DOCUMENT_ROOT}%1/wp-content/cache/supercache/%{HTTP_HOST}/%1/$1/index.html.gz -f
RewriteRule ^(.*) %1/wp-content/cache/supercache/%{HTTP_HOST}/%1/$1/index.html.gz [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{REQUEST_URI} ^(/wp)?/
RewriteCond %{DOCUMENT_ROOT}%1/wp-content/cache/supercache/%{HTTP_HOST}%1/$1/index.html -f
RewriteRule ^(.*) %1/wp-content/cache/supercache/%{HTTP_HOST}%1/$1/index.html [L]
</ifmodule>
# END WPSuperCache

Let me know what you think–performance stats show that it’s working fine for both the /wp subdirectory and the other subdomains!

WP Super Cache Benchmark

Posted in Blogging, Performance, Plugins, Scalability, WP, Wordpress by Elliott Back on September 28th, 2008.

If you’ve thought about whether upgrading from WP Cache 2.0 to WP Super Cache is a good idea, hopefully this benchmark will convince you. I followed my instructions on benchmarking Wordpress with Apache Bench on four configurations of this blog’s main page to measure performance:

  1. Without any caching plugins
  2. With WP Cache 2.0
  3. With WP Super Cache (no compression)
  4. With WP Super Cache (compression enabled)

wp-caching-plugins.png

The results show that WP Super Cache is a clear winner, performing 225% better than the older WP Cache. Here is the raw data I gathered during the test:

No caching:
Requests per second: 22.81 [#/sec] (mean)
Time per request: 4383.559 [ms] (mean)
Time per request: 43.836 [ms] (mean, across all concurrent requests)
Transfer rate: 613.75 [Kbytes/sec] received

WP cache:
Requests per second: 872.30 [#/sec] (mean)
Time per request: 114.640 [ms] (mean)
Time per request: 1.146 [ms] (mean, across all concurrent requests)
Transfer rate: 23549.46 [Kbytes/sec] received

Super cache (no compression):
Requests per second: 1518.90 [#/sec] (mean)
Time per request: 65.837 [ms] (mean)
Time per request: 0.658 [ms] (mean, across all concurrent requests)
Transfer rate: 41150.81 [Kbytes/sec] received

Super cache (compression):
Requests per second: 1960.39 [#/sec] (mean)
Time per request: 51.010 [ms] (mean)
Time per request: 0.510 [ms] (mean, across all concurrent requests)
Transfer rate: 53108.70 [Kbytes/sec] received

For more tips on how to improve your Wordpress performance, check out Wordpress Performance: Why My Site Is So Much Faster Than Yours. Another interesting WP caching plugin is Batcache, which uses the memcached backend to serve requests out of a cluster of machines’ RAM memory.

Wordpress.org 2.5 Redesign

Posted in Interface, WP, Wordpress by Elliott Back on March 29th, 2008.

With the release of their latest version of Wordpress, 2.5, the official Wordpress site has undergone a redesign by Happy Cog studios:

wordpress-25.png

The main page has been refreshed in boring, pastel colours, and prominent links to their Wordpress for Dummies book via Amazon affiliate link and their hosting affiliate suggestions have been added. I’m honestly not impressed with the redesign, which has included work on the administrative interface:

wordpress-25-admin.png

It’s as if they took the strong ideas and colors of Wordpress past, watered them down, spaced them out, and made sure everything looks sufficiently web 2.0 without actually adding a substantial improvement. Every administrative screen now looks different and inconsistent with the others. If I upgrade, I’m definitely going to miss the old theme. On the other hand, no work had been done since Wordpress 1.5 on the administrative look and feel, so any work, regardless of how it feels, is welcome. Perhaps this is just a stepping stone to a truly better admin panel?

The WP 2.5 release notes blog post indicates some other nice changes:

  • Multi-file upload with progress bar
  • EXIF extraction (the photobloggers will love this)
  • Password strength meter
  • Few-click plugin upgrades (I am expecting some 0day exploits here)
  • Built-in galleries
  • A new Shortcode API (Isn’t this just BBCode ripped off?)

I’ll probably end up installing this with the next release of my own blogs and themes, as the features look promising.

Next Page »