views:

44

answers:

3

It is possible to do that, invisible to the users (without redirect) ? I want to save the bandwidth

+1  A: 

If you want to avoid a redirect, you will have to proxy the requests. One way to do that is using mod_proxy.

Lukáš Lalinský
+1  A: 

Note that you can combine mod_rewrite and mod_proxy.

As mod_rewrite's documentation describes:

'proxy|P' (force proxy) This flag forces the substitution part to be internally sent as a proxy request and immediately (rewrite processing stops here) put through the proxy module. You must make sure that the substitution string is a valid URI (typically starting with http://hostname) which can be handled by the Apache proxy module. If not, you will get an error from the proxy module. Use this flag to achieve a more powerful implementation of the ProxyPass directive, to map remote content into the namespace of the local server. Note: mod_proxy must be enabled in order to use this flag.

Alex Brasetvik
This will save me some bandwidth?
mazgalici
+1  A: 

If you want to spare bandwidth, you need the client to do the actual transfer to your other host instead. To achieve this, you need to tell your client browser to change the url to load. This can only be done via redirect or similar mechanism afaik. The mod_proxy option will make the data loaded by your server and then dispatched to your client, ending in twice bandwidth use compared to local storage (where you only send to the client).

What is the issue with redirection to the image only ?

Zeograd
I also want to do the same way for some .swf. I'm affraid that isn't possible what I want to do so I think I will use a subdomain to host the images
mazgalici
Yes, subdomains for static resouces like image and swf is generally a good idea to dispatch bandwidth use to a separate server
Zeograd