Apache2: Redirect All Images To Image Server

Discussion in 'Server Operation' started by asyadiqin, Jul 30, 2007.

  1. asyadiqin

    asyadiqin New Member

    Hi,

    I've read about this somewhere a few weeks ago but didn't actually bookmark the site.

    Basically, I have 1 webserver running static HTML pages. I would like to create another webserver and use rsync between these 2 webservers.

    However, I have a spare old server that I would like to make into an image server, where all images will be stored. How can I do this in Apache2 on both webservers to redirect anything with /images/ to the image server.

    Thanks.
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. asyadiqin

    asyadiqin New Member

    More specific sites / guides?

    Thanks Falko.

    I know that its done using mod_rewrite but is there any sites that specifically shows how to do this with images, ie. redirect any request for any image files, ie .gif, jpg, .png ... from specific folders/url, eg. /images/, /photos/

    I'm not really good with mod_rewrite and regular expression, and since my sites are live, I would like more detailed guide to implement this.

    Thanks again.
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Try something like this:

    Code:
    RewriteEngine on
    RewriteRule   ^/images/~(.+)  http://imageserver/images/~$1  [R,L]
     

Share This Page