[Code Request] How to redirect under a Condition.

Siek

Regular Member
Joined
Feb 4, 2008
Messages
452
Reaction score
301
I know this is somewhere on the forum. I've been looking and i can't seem to find it.

Could someone please provide me with the code where a REDIRECT would only happen if they came from a specific site? This would avoid any problems with the companies finding my blackhat traffic if referrals were to pass that is. I would set up the redirect on my white hat site and therefore, the companies wouldn't have any traces of my blackhat site. I know this had something to do with stuffing a cookie on the blackhat site and enabling it on the whitehat site. (correct me if im wrong).

Or is there an easier way to do this? if i made a subdomain on my whitehat site and did a redirect from there, would the referral be just the domain and not the subdomain?

I hope that makes sense..

Thanks in advance. =)
 
You should be able to do this in .htaccess by using:

Code:
RewriteCond %{http_referer} ^http://([^.]+\.)*(yoursite)\.com
RewriteRule ^$ yourblackhatsite.html [R=302,L]

If the traffic comes from yoursite in the first line, it is redirected to yourblackhatsite.html


I'm sure there are other ways too, particularly using php, but this should serve your basic purpose (if I understood you correctly).
 
This is exactly what i was looking for - except for the fact that i wanted all my blackhat traffic redirected to my whitehate site. But i can see how i can change that easily.

Thanks alot man.
 
Back
Top