1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

mod_rewrite? question - tricky case

Discussion in 'Apache' started by mulligan, Oct 30, 2005.

  1. #1
    I have a PHP script, redirector.php on Server A that redirects requests to Server B. For instance a file is requested on Server A via the url: http://servera.com/redirector.php?filename=test.txt

    redirector.php send the request to server be like so:
    header("Location: http://serverb.com/test.txt");
    Code (markup):
    .

    It's important that requests to Server B arrive via the redirect from Server A. If they don't, I'd like to use a ReWriteRule or RewriteCond? to rewrite the requests back to Server A: http://servera.com/redirector.php?filename=test.txt

    Does anyone know if this is possible? Can any of the HTTP headers tell you if a visitor arrived via a redirect (or even a url rewrite)?

    Thanks in advance-

    m
     
    mulligan, Oct 30, 2005 IP
  2. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #2
    Sorry its late but I think using the referal url you can do what you are doing.
     
    Shoemoney, Oct 30, 2005 IP
  3. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The headers won't be able to tell you whether the visitor came from a redirect or not, but the HTTP_REFERRER variable will tell you which URL they came from, so you can use that in a RewriteCond
     
    johnt, Oct 31, 2005 IP