Redirect image filename to page url

Discussion in 'PHP' started by Scoty, Jan 18, 2010.

  1. #1
    Hi, basically I have someone linking to an image file on my site, it sends a decent amount of visitors but all they're seeing is the image, I don't want to just change the image file to something else (though when I found out I thought to put some gay porn or something first but I can't have such adult content on the server, let alone the fact I don't want to be looking at that stuff) anyway I've gone a little offtrack..

    They are linking to for e.g /images/file.png
    How can I use PHP (and .htaccess I believe is used for this?) to make that into a php file(or even just html file but I prefer consistency) which I then could insert a html redirect(or a php redirect if there is one) to go to /file.php? Of course I will be renaming the image file once doing this.

    Eating into the bandwidth I don't really care about what I do care is that those visitors are missing my site and only seeing the image file.

    Thanks,
    S
     
    Scoty, Jan 18, 2010 IP
  2. dsignresponder

    dsignresponder Greenhorn

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    18
    #2
    I believe you will have to create a RewriteRule, just match the extension in the regex and redirect your visitors as required! I think in that case your PHP file must send the image headers that would have been sent for the JPG file...
     
    dsignresponder, Jan 19, 2010 IP