Advanced .htaccess Security – Block Unwanted Referrers
For some bloggers and web developers, Digg can be a huge boost in traffic and thus a huge bust in ad revenue. Unfortunately, the Digg Effect can kill a website's bandwidth and get the website shut down. Wouldn't it be great if a weary web developer could prevent his site from being shut down by blocking users referred by Digg, at least a while? Using a small bit of .htaccess code and mod_rewrite, the developer can do just that.
The Code
RewriteEngine on
RewriteCond %{HTTP_REFERER} digg.com [NC]
RewriteRule .* - [F]
Say good-bye to Digg Death with this small, easy-to-place snippet of code!
![Create a CSS Flipping Animation]()
CSS animations are a lot of fun; the beauty of them is that through many simple properties, you can create anything from an elegant fade in to a WTF-Pixar-would-be-proud effect. One CSS effect somewhere in between is the CSS flip effect, whereby there's...
![Create Namespaced Classes with MooTools]()
MooTools has always gotten a bit of grief for not inherently using and standardizing namespaced-based JavaScript classes like the Dojo Toolkit does. Many developers create their classes as globals which is generally frowned up. I mostly disagree with that stance, but each to their own. In any event...
![9 More Mind-Blowing WebGL Demos]()
With Firefox OS, asm.js, and the push for browser performance improvements, canvas and WebGL technologies are opening a world of possibilities. I featured 9 Mind-Blowing Canvas Demos and then took it up a level with 9 Mind-Blowing WebGL Demos, but I want to outdo...
![MooTools Kwicks Plugin]()
I wrote a post titled Get Slick with MooTools Kwicks ages ago. The post was quite popular and the effect has been used often. Looking back now, the original code doesn't look as clean as it could. I've revised the original...
David,
I have a quick question for ya… can you make this .htaccess so you can transfer them to a “slimmed” down version of the same page or simply a blank page that says sorry digg users the site is offline for awhile?
One more question. When digg or any other site goes down for scheduled maintenance do they use this method to redirect all pages to a sorry we are down page?
Mark
Not a bad idea with your first question, Mark. Per your idea, I’d create a new sort of page template to do this. Say that “page.php” is getting hit hard and you want to show a slimmed down page. On page.php, you could check the referrer and if the referrer was digg, you could do a header() redirect to “slimpage.php?page=”.(yourpage). You’d them have slimpage.php provide a text-only version of your article.
As for a site being down, I’d bet that this is what they do. It’s very easy and very simple. Unfortunately, Digg, for example, doesn’t allow you to view their .htaccess file anymore.
What do you think abut blocking : “Options FollowSymLinks”, i think this is important also