I need a functionality where when a specific condition 'x' is met, ALL the href and src links on a page modify such that:
etc should become:
So basically the domain should change to a subdomain.
I am trying to do it using DOMDocument function but am not sure exactly how. Please help.