serve images from remote server

New to mod_rewrite? This is a good place to start.

Postby Guest » Sat Mar 09, 2002 4:10 am

I'm new to mod_rewrite!
We are tryinf to figure out a way to replicate all images to a remote server, and serve them from there, to preserve our offices bandwidth.
Is it possible for Apache/Mod_rewrite to check to see if an image exists on a remote server and, if it does, compare modification dates and then (if necessary) rewrite the URL to point to the remote file?
i.e our webserver is at http://our.server.com
We have all images replicated at http://remote.server.com/images/
if an html page contains a relative link to an image, say: /some_images/image.gif We want to check first to see if http://remote.server.com/images/some_images/image.gif exists and, if it does, rewrite the URL.
Ideally, we would also like to come up with a way to check modification dates as well, so that if a local image that had recently been uploaded had not been replicated to the remote server yet, then the local image is used.

Is this all possible with mod_rewrite?
Examples extremely welcome!

Al Fleming
Guest
 

Postby Brett » Tue Mar 26, 2002 1:40 pm

Couldn't you set up the remote server as a mirror of your main site, and just serve the images off the remote server? Check this link and see if it helps:
http://www.engelschall.com/pw/apache/re ... ide/#ToC26
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 26 guests

cron