Redirect from image files

Discussion in 'PHP' started by degy, Jan 2, 2007.

  1. #1
    Hy
    i'm looking for a way to redirect to same page every time anyone wants to access specific image (example.gif for example :p ). Something like scipts for preventing hotlinking. But for only one image. I can't use .htaccess becouse godaddy doesn't support it.

    Is this even possible?
     
    degy, Jan 2, 2007 IP
  2. ZareMedia

    ZareMedia Peon

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Without .htaccess or some apache configuration changes, no. An image request hits your webserver directly and this never comes into play with PHP.
     
    ZareMedia, Jan 2, 2007 IP
  3. degy

    degy Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ok i did it with .htaccess is there any way to know which image was hotlinked? $_SERVER["HTTP_REFERER"] doesn't work. And again, is this even possible :)
     
    degy, Jan 2, 2007 IP
  4. ZareMedia

    ZareMedia Peon

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What method exactly are you employing for hotlink prevention?
     
    ZareMedia, Jan 2, 2007 IP
  5. degy

    degy Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Exactly this :D well i read that it's only safe to redirect to files with same extention as the one hotlinked but this works for me
     
    degy, Jan 3, 2007 IP
  6. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I can't see why it would ever be unsafe to redirect to different file extensions.. that would kinda limit the main uses of mod_rewrite.

    degy, HTTP_REFERER will give you the referring page, i.e. the page that the image was linked from. Try REQUEST_URI instead..
     
    rodney88, Jan 3, 2007 IP