Pierre Bernard

My little hideout on the net

Deep linking to downloads

Looking at the download stats for HoudahGeo and HoudahSpot, I noticed that I still get a lot of downloads on long since outdated versions of both products.
I suspect this to be the effect of download sites deep linking to the ZIP files. Thus I have set up the following rewrite rules to redirect any deep link to the latest download:

RewriteCond %{HTTP_REFERER} !.*houdah.com.* [NC]
RewriteCond %{REQUEST_FILENAME} !.*latest.zip
RewriteRule  .* http://www.houdah.com/houdahSpot/download_assets/HoudahSpot\ latest.zip [R]


From the crontab I call:

cd /home/houdahco/www/houdahSpot/download_assets ; ln -sf "`ls -lrt | cut -c54- | grep -v \">\" | tail -1`" HoudahSpot\ latest.zip


This makes sure that the "HoudahSpot latest.zip" link always points to the latest version.
Comments