DZone 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

Snippets has posted 5883 posts at DZone. View Full User Profile

Prevent Yourself From Getting Slashdotted

  • submit to reddit
        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.    


Snippets Manager replied on Mon, 2012/05/07 - 1:11pm

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 ^.*.*$ you simply don't mind if the 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