PDA

View Full Version : how to ban some urls?



remzigulsun
07-31-2007, 03:10 AM
Hello,
I would like to know how to ban / deny certain urls. When I look at my latest visitors I see tons of visitors from a few websites. These are not real visitors and steal from my bandwith. I want to ban these urls but I don't know how to do it. As far as I understand it is done via .httaccess file but I don't know how to code it. And if you know another way to prevent this, I will be happy to learn it.

sjlplat
07-31-2007, 04:07 AM
I'd show you the code I use for my bandwidth theft redirection, but my server is down for the next 2 1/2 hours for maintenance.:eek: I'll post up as soon as my server comes back up.

This is the same type of code, but mine is a little more involved:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?YourSite\.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

RewriteRule \.(gif|jpg)$ http://www.YourSite.com/stop.gif [R,L]

Basically, you can create an image that says "Someone is stealing my bandwidth", and redirect any images that are not linked from your domain. You can create exceptions for domains you want to allow.