append URL string after domain name or file name
<p>i am passing a url as a param to the next page. ?url=<a href="http://domain.com" rel="nofollow">http://domain.com</a> i would like to set additional param to a querystring or the url. but only if a specific domain exists in the querystring.
i tried</p>

<pre><code>$url = preg_replace('{http://www.domain.com}','http://www.domain.com?foo=bar/',$_GET['url']);
</code></pre>

<p>but this is not working when there is a file name or other params.
any help is appreciated.</p>