views:

66

answers:

1

I've got a website that is running WordPress. It has several pictures that I am retrieving from a datafeed. The images from the datafeed are at locations like:

http://image4.example.com/640/examples/example.jpg
http://image4.example.com/640/example.jpg

The image4 and 640 locations can change. I want to rewrite the images to where they show as from my website.

I've tried:

rewritecond %{HTTP_HOST}     !^image4\.example\.com$  
rewriterule ^([^/]+)$ http://image4.mywebsite.com/$1 [L,R=301]

but it doesn't work. I don't know much about Mod Rewrite. any help would be appreciated, and no I'm not hijacking the images, i have permission to use them and the bandwidth.

Thanks -Brad

+1  A: 

So on your website you want to use an image like <img src="http://image4.mysite.com/image.png"&gt;, which should then be served from their servers? Then you need to reverse the logic of your current rules: now you match the host image4.example.com, and redirect them to image4.mywebsite.com, you want the opposite.

Keep in mind that if you redirect the requests, the user can still see that the images come from the other domains. The only way to solve this is by proxying the requests through your server, but then you will lose the speed gain from the other servers, and use up more bandwidth yourself.

Is it possible to set up your DNS so that image4.mywebsite.com ends up at their server? This might require their co-operation (if it is a virtual host, for example), but I think this would be the best of both worlds: users see everything from your domain, but you still get the benefits of hosting the images somewhere else.

You might get more useful answers if you add the "apache" tag, this is not really a WordPress(-only) question.

Jan Fabry
Dynamic Mirror works perfectly! Thank you!
Brad