Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Prevent yourself from getting Slashdotted (See related posts)

Assuming you have mod_rewrite and AllowOverride activated, throw this in the .htaccess file for the directory you don't want to be Slashdotted:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^.*slashdot.*$
RewriteRule .* - [F]


This all assumes the editors actually check the links before posting the story, but this should reasonably mean no-one on Slashdot can link to you, even if it's a bit over the top.

Comments on this post

gcb posts on Sep 06, 2005 at 21:46
well, that would be a pain if you ever make a post saying how nice that now your blog is slashdot prove...
/blog/slashdot_sucks.html

better use:
RewriteCond %{HTTP_REFERER} slashdot\.com\/

I haven't checked the syntax, but i assume that since you used
^.*<search>.*$ you simply don't mind if the <search> is at the begining or at the end, so you didn't have to bother specifying where the start and the end are... now apache don't have to store the match all the way from the start to the end of the string, you mighty win some few bits free in memory, that will be needed when the orde came from slashdot and simply re-request, now, without the referal :)

good luck

You need to create an account or log in to post comments to this site.


Click here to browse all 4863 code snippets

Related Posts