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?
views:
74answers:
2
+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
2010-01-28 21:12:48
+1 http://www.w3schools.com/TAGS/tag_base.asp
Jonathan Sampson
2010-01-28 21:13:18
Cheers Jonathan! Edited.
Pekka
2010-01-28 21:15:43
+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/">
Gumbo
2010-01-28 21:13:46