.htaccess to redirect an externally redirected domain to a specific page

Discussion in 'Apache' started by whose, Feb 27, 2008.

  1. #1
    One of my clients went out and bought a new domain name and took it upon themselves to use the domain registrar's domain forwarding to point it to their main site, but they are using the domain for a specific marketing campaign and we need to track the results of the visits it prompts to the main site.

    Is there a way to use .htaccess to catch the redirected traffic for that domain and send to another page we can track, or is it too late by the time it gets to our server?

    here is an example:

    domainB.com currently redirects to domainA.com
    (302 redirect according to seochat's redirect checker)

    we want to catch domainB.com and send it to domainA.com/TrackingPage

    tried PHP to get server vars as well, but nothing domain specific showed up.

    anyone have any suggestions or ideas?
     
    whose, Feb 27, 2008 IP
  2. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If it's a parked domain it's something like :

    RewriteCond %{HTTP_HOST} ^domainB.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.domainB.com$
    RewriteRule ^(.*)$ http://www.domainA.com/TrackingPage [R=301,L]

    And if it's a redirect in the .htaccess simply replace it with the one above.
     
    maiahost, Feb 27, 2008 IP
  3. whose

    whose Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks.

    I still needed to get the domain pointed to our nameservers to get the redirection to work, but once I did, this worked out great!

    Thanks again.
     
    whose, Feb 28, 2008 IP