Recent Topics

1 Feb 12, 2006 00:11    

This is slightly related to the spam threads about referers except I don't want to BLOCK them I just want certain ones to go elsewhere. I get a lot of traffic from specific sites that really should go to a different page now. A lot of those visitors are leaving because what they expected to find wasn't there and they're too lazy to do anything but hit the back button on their mouse. I'd like to be able to auto direct (before page load preferably) anyone being referred from certain domains to a new address. I'd like this to be something I can create a list for, but it's not that long so if I have to cut and paste a section a couple dozen times that's ok, they're all going the same place so it's not that bad.

This might fit better in the request section, but I don't think I'm actually requesting a hack/mod, just info on how to set this up. I'm running on a linux based server.

To rehash. I'd like any visitors referred from (ex) http://referdomain1.com/ to wind up at http://endpoint.mydomain.com/ instead of the page they actually were loading. 99% of these are just going to the domain and and not specifying a particular page themselves. I don't want to lose or stop these referers, just send them to a different location of mine.

2 Feb 12, 2006 00:21

its easily done using something like this (ive ommitted the 301 at the end, for instance)


RewriteEngine on
RewriteCond %{HTTP_REFERER} ^.*icky-domain.com.*$
RewriteRule ^/.*$ http://www.somewhere-else.com

be very careful with though, and dont mess with anyone coming from Google. Google hates [wiki]cloaking[/wiki].

3 Feb 12, 2006 00:37

do I have to do each one seperately. or could I do a set of referer's and the rule ones? how would I do that? Even one at a time this is definitely gonna help a ton. I get a lot of traffic that I really need going elsewhere but the buggers are hopeless when it comes to getting them to change links. Technically they're referer spammers but I can use the traffic myself as long as it goes the right place. :)

4 Feb 12, 2006 00:42

lol, I just got a great idea..wonder how fun it would be to set up something like this that spoofs a clickthrough for some affiliate ID

I know thats not kosher but if it were done for refering spam domains .. hmmm, that might be fun :P

Back to your question:

if you want to send one referer to one page and another referer to another page, yes you would need to do it sperately. If theyre all going to the same page then you could just do something like this:


RewriteEngine on
RewriteCond %{HTTP_REFERER} ^.*icky-domain.com.*$ [OR]
RewriteCond %{HTTP_REFERER} ^.*another-icky-domain.com.*$
RewriteRule ^/.*$ http://www.somewhere-else.com 

---

Back to my thought above.. given the right format of the clickthrough it wouldnt be hard to do that..


RewriteRule ^/.*$ http://www.gunbroker.com/auction/SellerAuctions.asp?User=id:51588

evil, very evil. how fun it would be to send poker referers back to a site that provides some sort of poker site affiliation, send porn referers to a porn site, and so on. dear lord, the possibilities 8|

5 Feb 12, 2006 00:54

wouldn't it be
RewriteCond %{HTTP_REFERER} ^*.icky-domain.com.*$
----------------------------------------^
with the *. rather than .* ?

6 Feb 12, 2006 01:00


RewriteCond %{HTTP_REFERER} ^http://(www\.)?icky-domain.com.*$ [OR]

and no.

Check the first paragraph on this page: http://www.regular-expressions.info/

regexs dont neccessarily follow the standard rules you might expect with wildcards.

you can play with it, theres a few applications out there that let you spoof your domain so you can check your rewrite rules, I dont have the links handy though.

7 Feb 12, 2006 01:05

For the most part I know the exact domains, they use a variety but they don't seem to change. I'll mess with this, so far no luck (testing using one of my own addresses as the referer) but this is the right track, I just need to fiddle and learn how to apply it to my particular setup.

Thanks a ton Whoo. :)

8 Feb 12, 2006 01:09

yw, and good luck. If you know the exact domains..

you can do this too:

RewriteCond %{HTTP_REFERER} ^http://www.ickydomain.com$ [OR]

theres a 100 ways Im sure..

9 Feb 12, 2006 01:29

I'm not having any luck. I can't get it to redirect.

I'm including an example from the .htaccess doc that was auto generated to deal with image linking so you can see the syntax used there, it used an extra !

RewriteCond %{HTTP_REFERER} !^http://www.wolfweb.us/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.wolfweb.us$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.bigstockphoto.com/bb/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.bigstockphoto.com/bb$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

Then, under that with a line space between I've got:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.wolfweb.us/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.wolfweb.us$      [NC]
RewriteRule ^/.*$ http://blogs.wolfweb.us


I've tried with and without the extra ! and other variations of my stock domain name. this isn't the actual referal I want to do but it's one I can use to test and get things working for. I used your [OR] as well as the NC version it used. I'm still digging up info elsewhere but there's lots of unhelpful sites for every one I find with any hints :(

I just tried

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^.*wolfweb.us/.*$      [OR]
RewriteCond %{HTTP_REFERER} ^.*wolfweb.us$      [OR]
RewriteRule ^/.*$ http://blogs.wolfweb.us


with no luck. the RewriteEngine on is at the top of the previous group of commands, do I need it for each set or is once on enough?

10 Feb 12, 2006 01:58

the problem was a / instead of \ in RewriteRule ^/.*$ http://www.somewhere-else.com

---edit----
hmmm, or not, lol, that just sent ALL traffic to the other address
I just noticed I'm not using the current release version so I'm doing the upgrade to Dawn. That might explain the problem. Hopefully the upgrade goes smoothly, it's uploading as I type. I did my backups but it's still frustrating when things don't go smoothly. :)

11 Feb 12, 2006 02:54

Updated to the Dawn release, working nicely. I went back to your original code for the htaccess, no luck. So I'm at a loss. Obviously I'm either missing something, doing something wrong, or there's a problem with the code and my particular setup.

(below is just a test to make sure my image theft block is still operating)
http://www.wolfweb.us/images/nikbg.jpg

12 Feb 12, 2006 03:40

if you like why not pm me one of the domains youre trying to redirect, and to where.. Ill see what I can come up with using exactly what you are trying to do.

13 Feb 12, 2006 06:32

just so anyone interested knows what the final solution was:


RewriteCond %{HTTP_REFERER} ^http://(www\.)?ickydomain.com.*$ [NC]
RewriteRule ^(.*) http://www.someplace-else.com/  [R=301,L]

14 Feb 12, 2006 06:47

you can only do one at a time, when you do multiple conditions it seems to break it. Not sure why yet. Doing one at a time works though.

15 Feb 12, 2006 06:59


RewriteCond %{HTTP_REFERER} ^http://(www\.)?ickydomain.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?domain2.com.*$ [NC]
RewriteRule ^(.*) http://www.someplace-else.com/  [R=301,L]

I'll bet youre not doing the OR's correctly :P. also, the last line does not need an OR.

16 Feb 12, 2006 09:31

I'll mess with that, but it didn't use OR's for the allow list for image linking and that works. Maybe just the different context but you'd think if it works for one type it'd work for the other... *shrug* list then rule obviously is more efficient, my list probably bites into the speed improvement of Dawn over the release I was running, but that's not an immediate crisis so I can work on it another time. :)

Thanks a ton for all your help.

Remy


Form is loading...