Redirect specific domains to another site via htaccess

allenb

New member
Oct 25, 2008
12
0
0
Hi guys,

Hoping somebody can please help here...

I'd like to redirect visitors from a domain (ex = mycompetiors.com) to another page (makemonies.com).

I found the code to block visiors from a domain or URL, but I'd much prefer to redirect them to another page. :)

Appreciate any help -- thanks guys!

Al B
 


Write this in your .htaccess file to redirect any page "example.com" to another page elsewhere "destination.com"

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^.*$ \"destination.com\" [R=301,L]
 
I typed this up in the quick reply box so no guarantees, but this should do it.

[high="php]$competitor = 'bad.com';
$redirect_url = 'http://www.makemoniesonline.com';
$ref = $_SERVER['HTTP_REFERER'];
if(strstr($ref, $competitor)) {
header('Location: ' . $redirect_url);
}[/high]
 
but i hope op knows that only works if linked from that site to his site... which a competitor wouldnt do