43 Folders

Back to Work

Merlin’s weekly podcast with Dan Benjamin. We talk about creativity, independence, and making things you love.

Join us via RSS, iTunes, or at 5by5.tv.

”What’s 43 Folders?”
43Folders.com is Merlin Mann’s website about finding the time and attention to do your best creative work.

Fun and functional ways to trick out your htaccess file

Stupid htaccess Tricks « Perishable Press

This is a terrific collection of tricks for hacking on your Apache htaccess file, including some very useful ways to save bandwidth, control site access, and generate havoc.

I have been known to do some "creative" forwarding based on referrers from time to time, and if you're in the mood to play a bit of psychedelic traffic cop with your own hosted site, there's enough here to keep you busy through the holiday weekend.

This one's an old favorite, from which bandwidth can be conserved, leeches can be smote, and hilarity can ensue:

>

Stop Hotlinking, Serve Alternate Content

>

To serve ‘em some unexpected alternate content when hotlinking is detected, employ the following code, which will protect all files of the types included in the last line (add more types as needed). Remember to replace the dummy path names with real ones. Also, the name of the nasty image being served in this case is “eatme.jpe”, as indicated in the line containing the RewriteRule. Please advise that this method will also block services such as FeedBurner from accessing your images.

>

# stop hotlinking and serve alternate content
><IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain\.com/.*$ [NC]
RewriteRule .*\.(gif|jpg)$ http://www.domain.com/eatme.jpe [R,NC,L]
></ifModule>

About Merlin

Merlin's picture

Bio

Merlin Mann is an independent writer, speaker, and broadcaster. He’s best known for being the guy who created the website you’re reading right now. He lives in San Francisco, does lots of public speaking, and helps make cool things like You Look Nice Today, Back to Work, and Kung Fu Grippe. Also? He’s writing this book, he lives with this face, he suffers from this hair, he answers these questions, and he’s had this life. So far.

Merlin’s favorite thing he’s written in the past few years is an essay entitled, “Cranking.”

 
EXPLORE 43Folders THE GOOD STUFF

Popular
Today

Popular
Classics

An Oblique Strategy:
Honor thy error as a hidden intention


STAY IN THE LOOP:

Subscribe with Google Reader

Subscribe on Netvibes

Add to Technorati Favorites

Subscribe on Pageflakes

Add RSS feed

The Podcast Feed

Cranking

Merlin used to crank. He’s not cranking any more.

This is an essay about family, priorities, and Shakey’s Pizza, and it’s probably the best thing he’s written. »

Scared Shitless

Merlin’s scared. You’re scared. Everybody is scared.

This is the video of Merlin’s keynote at Webstock 2011. The one where he cried. You should watch it. »