htaccess for photo sites

Keeping the lazy out of your photos without mod_rewrite

Full Member

joined:Aug 5, 2003
posts:246
votes: 6

In the thread "fixing a regex in htaccess" ([webmasterworld.com ]), I sought help with some htaccess setenvif regex's that would help keep the most popular community sites from stealing the over 2000 original celebrity photos we've taken over the years.

From people using photos as avatars (over and over on a page) to a Korean community site pulling over 80 Oscar photos off of our server, this was obviously a big issue for us.

Not having mod_rewrite on our server (which would enable us to switch the images to, say, an ad for our site) we needed to delve into the use of setenvif commands.

At first my htaccess file contained commands to block the most nefarious of the image thieves. It was then suggested that the most efficient method was to block _everyone_ and then selectively let in the "good guys" like the larger search engines. It was also debated whether or not to let in blank referers, which we decided to do.

With the help of jdMorgan, I looked at a list of the most used search engines and services and went to work checking which of them had changed their URLs. This was the result:

Now some of these lines will be based on personal choices. You have to decide if your blank referer accesses are "evil" or just folks using security software. You have to decide whether you get enough traffic from the search engines to warrant giving them some of your bandwidth, etc.

Another side project: when people now come to a photo from an href link on another site, the resulting 403 error is fed through a custom 403 page which looks up the photo and serves it up to them on its proper page, context, content, ads and all.