mirroring images

Using a single web hosting account to host multiple sites

mirroring images

Postby mstr » Tue Jan 22, 2008 1:45 pm

I've been searching answer for my problem fror this forum few days and googlin of course :) but i don't yet know if its possible what i'm after for.

So the problem is that i have one constant domain and changing image number like:

mydomain.org/123.jpg

image format can be any of commonly used like: jpg(?)|gif|png

and i have different mirrors for this image, example:

anotherdomain.com/123.jpg
yetanother.org/123.jpg

now an php script desides which server the image is shown from a link like mydomain.org/123/ is it possible to randomize the mirror by mod_modrewrite or rewritemap or so..

what i'm after is that i'd like to hide the the mirrors from the end user
so it sees only mydomain.org/123.jpg so if one of my mirrors go down the script can notice it and direct the end user to another.

i have access on mydomain.org with all priviledges and changin the mirrors httpd confs if it helps.

thanks for any advises, suggestions or examples in advance.
mstr
 
Posts: 1
Joined: Tue Jan 22, 2008 1:18 pm

Postby richardk » Wed Jan 23, 2008 11:16 am

I take it that you need to mirror the images because traffic i high? If that is the reason, the problem with keeping the domain the same is that all the image requests will have to first make a request to that domain. That won't actually reduce requests.

what i'm after is that i'd like to hide the the mirrors from the end user

You want them to never see it changes, or do you just want to keep it the same in the source of the page?

You could try this, it also requires mod_proxy (mod_proxy will use both domain's bandwidth/transfer, but keeps the URL change totally hidden)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteMap image_mirror rnd:/path/to/image_mirror.map

RewriteCond ${image_mirror:http} ^(.+)$
RewriteCond http://%1/ -U
RewriteRule ^(/.+\.(jpe?g|gif|png))$ http://%1$1 [P,L]

Then in /path/to/image_mirror.map
Code: Select all
http domain_one.com|domain_two.com|etc.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 21 guests

cron