Lately I’ve been getting insane traffic from Google Images and my host, HostForWeb, has been getting pissed off. The problem isn’t the bandwidth per-se, but the processing power required to render every page of my blog (complete with several hits to a MySQL database).
I don’t have the cash for a dedicated hosting package, so after being suspended for overpowering my shared-hosting box, I had to find a way to reduce the server-load or risk losing Keebler/Blog. That’s when I decided to turn to my old friend, The (free) Coral Content Distribution Network.
I’ve talked about Coral before, but I hadn’t tried to use them with WordPress until now. Their wiki has a way to use mod_rewrite to Coralize your pages, but in my case, I wanted to make sure only the breadth of my site (pages that don’t update that frequently, but could be hit with large amounts of traffic) was Coralized, while maintaining all the keebler.net URLs as much as possible. My solution was to add the following to the .htaccess file in the root directory of my blog, right after the line “RewriteBase /blog/”:
RewriteCond %{HTTP_USER_AGENT} !^(CoralWebPrx|Googlebot)
RewriteCond %{QUERY_STRING} !(^|&)coral-no-serve$
RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/?([0-9]+)?/?$ http://www.keebler.net.nyud.net:8090/blog/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [L]
Note that I’ve also allowed the Googlebot to index my site so it understands that all my content still belongs to keebler.net.
Using this method, all the individual blog entry pages will be Coralized, while the main page, archive pages, images, etc. will not be affected. Whenever someone follows a permalink on my blog, they will be redirected to the Coral cache of that page. The result is one hit to my server for every permalink page. If bandwidth becomes a problem, I can add another RewriteRule to cache images as well.
The downsides to this method are the “funny looking” keebler.net.nyud.net:8090 URLs that people might see, as well as a wait before comments appear on the site (since the pages are cached). However, that’s a small price to pay to keep Keebler/Blog on shared hosting
Common, you’d miss it ![]()