A little bit of background (you can skip this): I'm trying to create a simple proxy using PHP. All I am doing right now is using file() on a URL string and echoing everything with a foreach loop (if you really want to see it, it's here).
Anyway, I have a string of HTML that I need to fix so that no URLs on the page are local. In that, all HTML code that refers to locations like "/dir/file.ext" need to refer to "http://example.com/dir/file.ext". I have looked at DOMDocument and Tidy, but I'm not so sure how I'm going to go about this. Any ideas?
...I did consider setting up RewriteEngine attributes in my .htaccess file, but it seemed that might not catch all instances - or would it?