title: How to regenerate url path dynamically in PHP?
body: <p>I created simple project in PHP and seperated my works to different folders.</p>
  <p>My folder structure:</p>
  <pre><code>system
  ├── dashboard
  │   ├── account
  │   │   └── logout.php
  │   ├── employees
  │   │   └── addemployee.php
  │   └── layout
          └── sidebar.php
  </code></pre>
  <p>In my sidebar.php I have listed items with links. And I load this sidebar.php in every required PHP pages. But the problem is that the path of links changes on the pages where sidebar.php is loaded.</p>
  <p><strong>Example:</strong></p>
  <p>In the addemployee.php where sidebar.php and its links are loaded:</p>
  <pre><code>&lt;a href=&quot;account/logout.php&quot;&gt;Logout&lt;/a&gt;
  </code></pre>
  <p>Normally the path of the Logout should be like this:</p>
  <p><em><code>http://localhost/system/dashboard/account/logout.php</code></em></p>
  <p>But its not so. This path changes in the addemployee.php page as follows:</p>
  <p><em><code>http://localhost/system/dashboard/employees/account/logout.php</code></em></p>
  <p>How can I prevent this from happening?
  Thank you</p>