Redirect image requests.

Discussion in 'Apache' started by CPURules, May 2, 2008.

  1. #1
    Ok, here's what I want to do.

    I have a website set up, and I'm concerned about non-existant image files. I think what I want to do, can be done with .htaccess
    Anyway, my image directory setup looks like this:

    htdocs
    -images
    --138279.jpg
    --153968.jpg
    --167833.jpg
    --183219.jpg
    --notavailable.jpg

    The .jpg files(apart from notavailable.jpg) are all pictures I've taken. If someone tries to access a picture that is NON-EXISTANT(and only the jpg files) such as 195823.jpg, it keeps the same URL, but notavailable.jpg is displayed.

    Examples:
    URL Entered: http://site.com/images/138279.jpg
    URL Shown in URL Bar: http://site.com/images/138279.jpg
    Effect: Shows the picture

    URL Entered: http://site.com/images/195823.jpg
    URL Shown in URL Bar: http://site.com/images/195823.jpg
    Effect: Shows notavailable.jpg

    If this is even possible, please let me know. I will +rep for your help.

    TIA.
    -Charlie
     
    CPURules, May 2, 2008 IP