Impossible? Any way of doing this with .htaccess?

Discussion in 'Programming' started by financialjesus, Jun 1, 2011.

  1. #1
    I have a really simple problem that probably requires a complex solution.

    I own a website that hosts funny and interesting pictures - a lot of them.

    If someone clicks on a direct link to an image that is hosted at my server is there a way to redirect that person from the actual *.jpg file to the blog post featuring the same picture?

    For example:
    The file:
    http://www.moneyandshit.com/wp-content/uploads/2010/10/bike_world_war_2.jpg
    Should be automatically redirected here:
    http://www.moneyandshit.com/boy-and-his-bike/

    Is this possible?

    Sometimes a person takes a link to a picture in my website and sends it to their friends or posts it to Facebook - the pictures get thousands of shows without the people ever getting to my blog.

    Is there any way to achieve this with .htaccess or any other way?
    All ideas are welcome!
     
    financialjesus, Jun 1, 2011 IP
  2. screamer

    screamer Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    google it "htaccess deny direct access to images"
     
    screamer, Jun 1, 2011 IP
  3. mike30

    mike30 Well-Known Member

    Messages:
    887
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    140
    #3
    I guess it could be achieved making a script with a class that generate the image from database. And its output instead been a simple image, it could output a link with your image in it.

    ~Mike
     
    mike30, Jun 1, 2011 IP