PHP header(location:) redirect with root directory
<p>Is there a way to create a  <code>header('Location:');</code> path that starts to the root directory.</p>

<p>Examples Like:</p>

<pre><code>formaction="/cert/forms/sessions/session-inc-info.php" 
</code></pre>

<p>or</p>

<pre><code>include($_SERVER['DOCUMENT_ROOT'].'/cert/forms/sessions/session-inc-info.php');  
</code></pre>

<p>cert is my root directory folder</p>

<p>ive been trying codes like</p>

<pre><code>header('Location:'.$_SERVER['DOCUMENT_ROOT'].'/cert/forms/sessions/session-inc-info.php);
</code></pre>

<p>and</p>

<pre><code>header('Location:/cert/forms/sessions/session-inc-info.php');
</code></pre>

<p>the only thing works for me is using <code>../</code></p>

<pre><code>header('Location:../../../session-inc-info.php');
</code></pre>

<p>but it's hard for me because i have alot of folders and subfolders.
and i have so many scripts that have to be redirected. </p>

<p>Thanks.</p>

<p>so this is the sample folder structure</p>

<p><a href="https://i.stack.imgur.com/q48wR.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/q48wR.jpg" alt="enter image description here"></a></p>

<p>so the <code>content.php</code> will have a button that redirects to the <code>session.php</code> and i have done that already and now when the <code>session.php</code> script will have a <code>header('Location:');</code> that must redirect to the dashboard.php . now that is my problem. i don't now how to create the path like </p>

<p>cert---->dashboard----->dashboard.php </p>