PDA

View Full Version : Apache2: Redirect All Images To Image Server


asyadiqin
30th July 2007, 17:52
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.

falko
31st July 2007, 15:27
You can do this with mod_rewrite: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

asyadiqin
31st July 2007, 15:58
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.

falko
1st August 2007, 19:30
Try something like this:

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