Non-working Videos

If any of my videos/music/animations weren’t playing for you on my blog or gallery today, it was due to a recent change that I had made to combat hot-linking which has caused about 12GB of data transfer in the past 30 days. Baidu.com (a big Chinese search engine) apparently linked directly to an mp3 I have in one of my old blog posts: 永恆的記憶, and it almost reached 30,000 requests. My statistics show that ~12GB of data was transferred during the last 30 days and that mp3 was responsible for 98% of it.

I found out some interesting things.

First, my regex for my RewriteCond in my .htaccess file was incorrect:
!^http://(.*\.)?krunk4ever.com(/.*)?$

which I realized now that any URL that included “krunk4ever.com/” as part of the URL would pass right through.

I fixed my regex so now that krunk4ever.com has to be the domain:
!^http://([^/]*\.)?krunk4ever.com(/.*)?$

Next I was looking through my access logs and it appears that when you embed a media file (such as an mp3 or video), the referring URL is null and the agent is actually the media player, in which case, it was showing up as WMP11 mostly.

I’ve always allowed direct loading (as in copying and pasting the link into the browser), but decided to prevent cases like these. I went ahead and also blocked referring URLs that were null/empty.

Xyon pointed out to me earlier today that my videos weren’t playing, but if he clicked the “Download Movie” link, it’d work.

Of course! The purpose of blocking the null/empty referring URL was to prevent embed media files that link to my site. It would make sense any embedded media on my site would hit the same problem. Therefore, I’ve fixed the access rights again so that only that particular file will be blocked when referring URL is null/empty. All others should be fine.

If you haven’t seen the static electricity video (which was broken earlier today), do get a chance to see magic!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.