How to reliably get the current URL in PHP?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/189113/how-do-i-get-current-page-full-url-in-php">How do I get current page full URL in PHP</a>  </p>
</blockquote>



<p>I want to do something like this:</p>

<pre><code>if (current url is 'site.com/dir1')
    do something;
else if (current url is 'site.com')
    do something else;
</code></pre>

<p>What's a reliable way to find this out? Thanks.</p>
