Usually traffic is a good thing. Many find it difficult especially in the early stages of site development to get traffic visitors at all. So most people or sites are more than happy to get any and every kind imaginable.
But, every now and then your site may experience some traffic or visitors originating from a site that does not fit your guidelines, values, approval, or similar.
Say for instance you have a site that is catered to kids or maybe your site is affiliated with a religious organization, group, or similar for example.
You recently check your hosting logs, stats, visitors, etc. in your hosts control panel and you notice a fairly substantial amount of traffic coming from an adult related site. You have no idea why your link or site would be there on that kind of site to begin with, or how it even got there. This type of scenario does happen from time to time. Incidentally if your hosts control panel has awstats available it has very good stats to quickly identify something like this.
Here is a screen shot from awstats. You can see the "Links from an external page (other web sites except search engines)". This list will tell you where traffic is coming from and how many visitors. You will be able to see the actual site and link in the blacked out area. Then, you can use this information to check out any site or links in question, and to block, redirect, forward, etc. should you ever decide to do so.
So with the example given above say you really would rather not have adult related traffic from such a site or link coming to your non-adult site. Not only that, but maybe this traffic is chewing up a bunch of bandwidth or other server resources you would like to reduce.
You can't really block by ip address in this case because each incoming visitor would have a different ip address. You would basically be there all day blocking ip's that would do little or no good.
What you can do is use .htaccess to prevent the incoming referring link from reaching your site. You could deny the incoming traffic from the site or link in question completely. Or, maybe you simply redirect or forward the incoming traffic from the site or link to somewhere else.
This can be applied to any web site with .htaccess as long as your host has mod_rewrite enabled.
If you are using Dolphin and it is installed in your root/main/http docs/public_html directory then you would add to:
http://www.yoursite.com/.htaccess
If you are using Dolphin and it is installed in a subfolder/subdirectory then you would add to:
http://www.yoursite.com/dolphin-directory/.htaccess
Add to .htaccess file after the line RewriteEngine on like:
RewriteEngine on
RewriteCond %{HTTP_REFERER} baddomain\.com [NC]
RewriteRule .* - [F]
To forward or redirect traffic from the unwanted site or link to somewhere else then add:
RewriteEngine on
RewriteCond %{HTTP_REFERER} baddomain\.com [NC]
RewriteRule .* http://en.wikipedia.org/ [R,L]
Note:
-Change RewriteCond line: baddomain\.com to the link or site you want to prevent.
-Change RewriteRule line: http://en.wikipedia.org/ to the link or site you would like to redirect or forward it to.
--Be sure to download and backup your original .htaccess file prior to editing it. Htaccess is extremely sensitive and needs to be exactly right, or it can make your entire site error out.
---And be sure you test afterward to ensure everything is working properly. You do not want to accidentally block all traffic to your site.
If you want the traffic, and bandwidth is not an issue, then no need to worry or mess with this.
It may not be an issue or problem for your site at the current time, but should it become one in the future file this away for future reference.