1KM1KT .pdf linkage

I’m particularly proud today of one of the features of 1km1kt that prevents people from linking directly to the .pdf files from the outside. The purpose of this is twofold:

1KM1KT’s primary content comes from the downloading of .pdf files which can get rather large in size and consume a large amount of bandwidth. By preventing people from linking to the .pdf’s directly, we can encourage visitors to visit the landing page for that piece of work. The effect is that visitors see the contributing author’s landing page, have the opportunity to browse for other work, can see the author’s other contributions, and can view announcements from 1KM1KT.

This is all done with a rewrite rule in the .htaccess file:

#Restrict hotlinking of specified file types from all but specified referrer and blank referrers
RewriteCond %{REQUEST_FILENAME} \.(pdf)$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !1km1kt\.net [NC]
RewriteCond %{HTTP_REFERER} !bloglines\.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.*)/(.*).pdf /redirect.php?Terms=$2&url:www.1km1kt.net/$1 [R,NC,L]

It not only prevents hotlinking from all but the specified sources (we still want google to be able to link to .pdfs as well as 1km1kt), but instead of just denying the user, it redirects them to a custom landing page built using the file name as a search term. Try it out here:

http://www.1km1kt.net/rpg/1km1kt.pdf

This keeps us from losing traffic with broken external links, and still allows us to guide the user experience through the site.


Comments are closed.