1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mod_rewrite help

Discussion in 'PHP & Perl' started by happyhatter, Mar 7, 2010.

  1. happyhatter

    happyhatter Registered Member

    Jan 26, 2009
    Likes Received:
    I'm trying to get this example Search a database of images to work but it uses mod_rewrite.

    I found a mod_rewrite sample for images here but I'm not quite sure what to put in the QUERY_STRING:

    RewriteRule ^(.*)\.jpg /pix/feeder.php?image=$1&%{QUERY_STRING}
    All .jpg requests are passed on to a PHP script, with the image name passed in as a parameter. Why do we do this?

    • it saves a directory with a large number of pictures getting cluttered
    • it allows us to monitor where images are loaded from (the referer) so highlighting any images hotlinked from other web sites
    • it allows us to generate dynamic images (for example, this diagram of current train cancellations on First Great Western ;-) )
    • it allows us to feed out low res or high res alternatives
    • it allows us t maintain image data with the image
    • and it allows us to use selected URLs to generate a random image.
    Last edited: Mar 7, 2010