43 Folders

43 Folders feed subscription icon - Shiny!Time, Attention, and Creative Work. After 4 years and a lot of productivity pr0n, we’re shifting gears. Re-learn how to use 43 Folders. Then back to work. [»]

”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>


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
O&amp;#8217;Flaherty - &amp;raquo; 43 .htaccess tricks's picture

[...] Okay, the titles a...

[…] Okay, the titles a little inaccurate but 43 Folders posted a link to a great Wikipedia article full of .htaccess goodness. […]

About Merlin Mann

Merlin Mann's picture

Bio

Merlin Mann is an independent writer, speaker, and broadcaster. He’s best known for being the guy who started 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. Also? He looks like this, answers questions, and has something like a life.

Merlin’s favorite thing he’s written recently is a short essay called, “Better.”

 
EXPLORE 43Folders THE GOOD STUFF

An Oblique Strategy:
Not building a wall; making a brick


STAY IN THE LOOP:

Subscribe with Google Reader

Subscribe on Netvibes

Add to Technorati Favorites

Subscribe on Pageflakes

Add RSS feed

The Podcast Feed

Inbox Zero

The original 43 Folders series looking at the skills, tools, and attitude needed to empty your email inbox — and then keep it that way. Don’t miss the free video of Merlin’s Inbox Zero presentation.

Making Time

3-part series on attention management for artists and makers. Read Bad Correspondence, The Job You Think You Have, and One Clear Line.