Wednesday, November 22, 2006

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

 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]

, , , , ,

43F feed sponsored by:

Visit Office Depot today for tools and advice to help you increase productivity and improve time management. You can learn more at the 43 Folders Office Depot Page.

Merlin Mann Wed, 22 Nov 2006 18:39:05 +0000



Source: http://feeds.feedburner.com/~r/43Folders/~3/52798112/
To unsubscribe from this feed, click here
To manage other subscriptions, click here

Powered by RssFwd
Hosting sponsored by Publicaster - Powerful Email Marketing Solutions by Blue Sky Factory, Inc

0 Comments:

Post a Comment

<< Home