tags:

views:

74

answers:

2

I am retrieving a page from another host and then initializing the FORM with data from a DB, before sending it on to the end user; but I need to make the URLs in hrefs and srcs absolute so my browsers load them from the right place. Can I set a HTTP header to cause this to happen without modifying the HTML?

+4  A: 

No. The only way to do that would be a <base> element in the HTML output.

See docs here: HTML <base> Tag

Alternative idea

if you can't touch the HTML, you should be able to put something together using mod_rewrite. You would build 301 redirect statements for your image resources, that will point forward to a remote server. The only condition for this is that your image requests follow a fixed pattern (e.g. /images/xyz.jpg) that you can translate into a RewriteRule.

Check out this tutorial to get you started.

Pekka
+1 http://www.w3schools.com/TAGS/tag_base.asp
Jonathan Sampson
Cheers Jonathan! Edited.
Pekka
+7  A: 

There is no such for HTTP. But you can set the base URL with HTML’s BASE element like:

<base href="http://example.com/"&gt;
Gumbo