### The Tao of Mac

I performed a few minor upgrades to the server OS, Apache, mySQL, PHP, etc. today that resulted in some minor breakage, but everything should be OK now. The only things that ought to be broken are web-based RSS aggregators - see the changes below, which were rolled into the upgrade. NetNewsWire, FeedDemon and other application-based aggregators ought to work perfectly.

As a bonus, the server should feel a little faster (around 5-10% on complex pages that required a lot of database hits and/or PHP processing).

## Petty Theft

Kudos to Eduardo for a neat little snippet of mod_rewrite magic that prevents folks from simply cutting and pasting our site's HTML and images in theirs:

# tail -4 .htaccess

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https?://(the\.)?taoofmac\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$RewriteRule \.(jpe?g|gif|bmp|png|css|js|swf)$ - [F]

(Mine is actually a bit larger than this right now, but I'm not going to give the whole game away.)

I had noticed a lot of extraneous requests for photos, some inline images and the omnipresent link gif lately, and this stops all of that "log noise". People are free to link and/or quote nearly all of my stuff - with the exception of photos - provided they don't waste my bandwidth and keep all the copyright notices - or if there is no copyright, providing proper attribution (which I painstakingly provide myself every time I quote someone).

The big disadvantage of this is that server-side or web-based RSS aggregators will not display inline images in the site feed. I have tested a few application-based aggregators and they work fine, but anything that attempts to display inline HTML from the RSS feeds without rewriting (and preferably caching) the image URLs is very likely to choke.

Mind you, mod_rewrite is considered moderately evil. Nothing like mod_perl (mastery of which is considered akin to joining the Dark Side of the Force), but it should be used with care.