How to direct traffic from a specific domain to a different page on my site

Discussion in 'HTML & Website Design' started by JMo, Jun 4, 2007.

  1. #1
    For example: I have mysite.com. I want anyone coming from xyz.com to be directed to mysite.com/index2.html, and everyone else to go to the usual mysite.com/index.html

    Is this possible? If so, how can it be accomplished?

    Thanks!
     
    JMo, Jun 4, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    Check the request URI through .htaccess or through a server side script.

    e.g.
    RewriteCond {%HTTP_HOST} ^(www\.)?xyz.com
    RewriteRule .* http://mysite.com/$1
    Code (markup):
     
    krt, Jun 4, 2007 IP
  3. JMo

    JMo Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks krt. I tried creating an .htaccess file, but what I want is still not happening. Let me explain myself again to make sure I'm making sense:

    Say someone is on www.xyz.com looking at some page, and they click on a link to www.mysite.com I want that person to be redirected to www.mysite.com/dt/index.html So basically I think what I need is: any links coming from the xyz.com domain need to be redirected.

    My .htaccess file looks like this:

    RewriteEngine on
    RewriteCond {%HTTP_HOST} ^(www\.)?xyz.com
    RewriteRule .* http://mysite.com/dt/$1
    Code (markup):
    Do I have it right? I've tried researching this in several places, but can't come up with a solution. Thanks again!
     
    JMo, Jun 5, 2007 IP
  4. JMo

    JMo Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I think I may have just been unaware of the terminology. This seems more like what I need to do:

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?xyz\.com [NC] 
    RewriteRule (.*) http://mysite.com/dt/$1 [R=301,L]
    Code (markup):
    Does this seem correct? It's still not working. The link to mysite.com is actually on a page: subdomain.xyz.com if that makes a difference. Any help is much appreciated.
     
    JMo, Jun 5, 2007 IP
  5. JMo

    JMo Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    This is driving me crazy. I can't figure out why it's not working. Can anyone help?
     
    JMo, Jun 5, 2007 IP
  6. JMo

    JMo Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Can someone look at the code and tell me if it should work? At least that way I would know the problem is elsewere. Perhaps the ISP (1and1).
     
    JMo, Jun 6, 2007 IP
  7. Anghus

    Anghus Peon

    Messages:
    510
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Anghus, Jun 6, 2007 IP