StatCounter User Forum  
StatCounter Free web tracker and counter

Go Back   StatCounter User Forum > StatCounter.com > Help

Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2005, 07:50 AM
vix vix is offline
Junior Member
 
Join Date: Jan 2005
Posts: 11
Default Referrer's

Is there a way to block certain referrer's....someone put a link to my site on another site that I don't want it on....is there a way to block that referrer?

Thanks in advance.

Vix
Reply With Quote
  #2  
Old 01-20-2005, 08:22 AM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,147
Default Re: Referrer's

Quote:
Originally Posted by vix
Is there a way to block certain referrer's....someone put a link to my site on another site that I don't want it on....is there a way to block that referrer?

Thanks in advance.

Vix
Not unless you do your own detection of the referrer in javascript and redirect the logic elsewhere.
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.
Reply With Quote
  #3  
Old 01-20-2005, 05:28 PM
vix vix is offline
Junior Member
 
Join Date: Jan 2005
Posts: 11
Default

Can you point me someplace that tells me how to do it or tell me here o something of the like?
Reply With Quote
  #4  
Old 01-20-2005, 07:30 PM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,147
Default

You can add a ascript like this in the <head> portion of your page if you want all the links to all come in from your site only:

Quote:
<script language="JavaScript" type="text/javascript">
<!--
var domain = "http://YOURSITE.com";
var domainAlias = "http://www.YOURSITE.com";
var error = 'ERROR_PAGE.HTML'; // Page unwanted referrers are redirected to

/*
JavaScript by Dave Lauderdale
Published at: www.digi-dl.com
*/

if (document.referrer.indexOf(domain) == -1 && document.referrer.indexOf(domainAlias) == -1)
{
alert("ERROR: Invalid referer");
location.replace(error);
}
//-->
</script>
Or to block links coming in from another site, just by reversing the test:

Quote:
<script language="JavaScript" type="text/javascript">
<!--
var domain = "http://BANNED-SITE.com";
var domainAlias = "http://www.BANNED-SITE.com";
var error = 'ERROR_PAGE.HTML'; // Page unwanted referrers are redirected to

/*
JavaScript by Dave Lauderdale
Published at: www.digi-dl.com
*/

if (!(document.referrer.indexOf(domain) == -1 && document.referrer.indexOf(domainAlias) == -1) )
{
alert("ERROR: Invalid referer");
location.replace(error);
}
//-->
</script>
For instance I set up the test to ban a referrer not from my own site at http://widget.webado.com/test-ip-ban/test-referrer.html . It will accept if you test http://widget.webado.com/test-ip-ban...referrer1.html however.

http://widget.webado.com/test-ip-ban...referrer2.html shows a ban on http://my.statcounter.com as referrer.

None of this works for non-javascript enabled browsers or, naturally, if the user just copies the link and uses it directly in the browser.

Also the tests may be different for different browsers, this works in IE, not sure about Firefox or others.


---- Later ----

Actually it works in Firefox as well.
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.

Last edited by webado; 09-08-2007 at 02:17 AM.
Reply With Quote
  #5  
Old 01-20-2005, 07:37 PM
robinev robinev is offline
Senior Member
 
Join Date: Jul 2004
Location: Seattle WA USA
Posts: 1,010
Default

This is another case where mod_rewrite might help. I've been trying -- so far unsuccessfully -- to do something with the referer information.

In the course of investigating that, I came across this tidbit which might provide a partial solution to your problem:
Quote:
RewriteCond %{HTTP_REFERER} ^http://members.asianavenue.com/I_am_that_guy/$
RewriteRule ^/pics/house/DCP00047-320.jpg$ /images/babyshit.jpg [P]
You'd need to modify the RewriteRule (maybe use ^(.*)$ as the left-side value. And I haven't tested this and have been unable to get a similar thing to work so far, but it's worth a try if you're comfortable mucking with such a bizarre Unix "feature".

Last edited by webado; 09-08-2007 at 02:18 AM.
Reply With Quote
  #6  
Old 01-20-2005, 08:12 PM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,147
Default

Quote:
Originally Posted by robinev
This is another case where mod_rewrite might help. I've been trying -- so far unsuccessfully -- to do something with the referer information.

In the course of investigating that, I came across this tidbit which might provide a partial solution to your problem:
Quote:
RewriteCond %{HTTP_REFERER} ^http://members.asianavenue.com/I_am_that_guy/$
RewriteRule ^/pics/house/DCP00047-320.jpg$ /images/babyshit.jpg [P]
You'd need to modify the RewriteRule (maybe use ^(.*)$ as the left-side value. And I haven't tested this and have been unable to get a similar thing to work so far, but it's worth a try if you're comfortable mucking with such a bizarre Unix "feature".
Better not. Too dangeorus. The .htaccess file is very delicate and can mess things up royally if not handled properly. Besides many hosts don't allow using one or modifying it anyway. It can interfere with FrontPage extensions for instance. And it's either not available or doesn't work in the same way on windows servers in any case.
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.

Last edited by webado; 09-08-2007 at 02:18 AM.
Reply With Quote
  #7  
Old 01-20-2005, 08:45 PM
robinev robinev is offline
Senior Member
 
Join Date: Jul 2004
Location: Seattle WA USA
Posts: 1,010
Default

Quote:
Originally Posted by chrisooc
Better not. Too dangeorus. The .htaccess file is very delicate and can mess things up royally if not handled properly. Besides many hosts don't allow using one or modifying it anyway.
Good point. And I did try to indicate the it should be done only by someone who feels comfortable with such things.

The standard redirects in .htaccess are fairly simple and easy enough to set up -- and not all that dangerous. I use it to set a custom error page and to handle bad search-engine information, taking users from the ancient pages Yahoo used to serve up to something similar and current. It's a far more elegant and a faster solution than using meta redirects or something similar that depends on client-side processng.

mod_rewrite, on the other hand, is both tricky and dangerous, but also very powerful. I use it now only to create a canonical host name, converting everything that isn't www.ttca.org into that name. What I'm trying to do now is also redirect several requests that have been coming in from Google's non-US image results. It doesn't work yet, but I think I'm a good enough tester to both notice and overcome the problems that arise.
Reply With Quote
  #8  
Old 01-20-2005, 09:36 PM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,147
Default

Hmmm.... half of this stuff just went over my head LOL!
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.
Reply With Quote
  #9  
Old 01-20-2005, 10:00 PM
vix vix is offline
Junior Member
 
Join Date: Jan 2005
Posts: 11
Default

Quote:
Originally Posted by chrisooc
Hmmm.... half of this stuff just went over my head LOL!
more than half went over my head but i'm gonna give it a go later and see what happens...

thanks folks.
Reply With Quote
  #10  
Old 01-20-2005, 11:24 PM
Arne's Avatar
Arne Arne is offline
Moderator
 
Join Date: Sep 2004
Location: Lulea, Sweden
Posts: 3,954
Default

Quote:
Originally Posted by chrisooc
For instance I set up the test to ban a referrer not from my own site at http://widget.webado.com/test-ip-ban/test-referrer.html . It will accept if you test http://widget.webado.com/test-ip-ban...referrer1.html however.

http://widget.webado.com/test-ip-ban...referrer2.html shows a ban on http://my.statcounter.com as referrer.
Works on Mozilla Suit also, so the script can't be to old

What if you remove the "alert" part from the script, does it work then?
Seams to me that it would be much more fun to redirect the visitor from a banned site directly to an other site, without the alert. I can imagine certain kind of sites I would use to make the banned sites owner look really dirty minded
__________________
Statcounter: Forum Rules, Knowledge Base, FAQ

Attention! When reporting problems with your counter, please tell what
partition yours is on by looking at the code you inserted and you will see:
var sc_partition=xx; in the Javascript portion, where "xx" is the number.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:37 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.