Server name along with folder structure php
<p>I have a little task on hand now. I want to send an email to a newly registered user from a page along with a link to confirm the email address. </p>

<p>In the email code, i have used <code>$_SERVER[SERVER_NAME]</code> to generate the link.
This works fine if the application is in the root of the domain. For example:</p>

<p><code>www.example.com/file.php</code></p>

<p>But I have an extra folder i.e <code>www.example.com/folder_name/file.php</code></p>

<p>Is there any way to generate the link www.example.com/folder_name/file.php without hardcoding the name of the folder?</p>
