The situation:
On server A we want to display content from server B in line on server A.
The problem:
Some of the hyperlinks in the content on server B are relative to server B which makes them invalid when displayed on server A.
Given a block of HTML code that contains anchor tags like the following
<a href="/something/somwhere.html">Somewhere</a>
what would be the most efficient way to convert them to
<a href="http://server-b.com/something/somewhere.html">Somewhere</a>
There can be multiple anchor tags in the content, the one catch is that some might be absolute and I want to leave those as they are, I only want to prepend the domain of server B to the relative URLs