Yesterday, and earlier this week, my VPS ran out of processes. Earlier this week, I wasn’t too worried about it. Apache going nuts running alot of processes. Friday morning, same thing. Well Fridy I decided to take a look over the apache logs files. I host a few images at vurdlak.chemicalwarfare.us, for mightyillusions.blogspot.com (note cool website). Retards from myspace and other sites, making direct links to my images, aka hotlinking. Getting hit so much, plus the size of the files didn’t help. Both Tuesday, and Wednesday, vurdlak.chemicalwarfare.us had close to 65,000 hits to it.
So I went ahead did some googling. Found some information for creating a .htaccess file that will prevent hotlinking. I was very tempted to change the file to some donkey loving porn, and but had to resist.
Here’s the .htaccess file that I used.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mightyillusions.blogspot.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?vurdlak.chemicalwarfare.us/pictures(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?blogspot.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?google.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*\.gmodules.com(/)?.*$ [NC] #cool wildcard trick. So 16.gmodules.com will work.
RewriteCond %{HTTP_REFERER} !^http://(www\.)?vurdlak.googlepages.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://vurdlak.chemicalwarfare.us/pictures/hotlinking.gif [R,NC]
Basically traffic anywhere, except for the domains above will get sent to the hotlinking.gif file. Here is the image.
