title: HTML including CSS using PHP
body: <p>I am trying to build a one-page dynamic site and I've hit a roadblock. Since URLs like:</p>
  
  <pre><code>index.php?page=Tutorials&amp;Article=0
  </code></pre>
  
  <p>aren't really all that pretty, I decided to use .htaccess to rewrite URLs, in this case like so:</p>
  
  <pre><code>Tutorials/Articles/0
  </code></pre>
  
  <p>But that means most of my includes won't work since I use paths relative to the root path of the site:</p>
  
  <pre><code>js/jquery-1.9.1.min.js
  </code></pre>
  
  <p>I've tried to work around these by using the following code included at the beginning of index.php:</p>
  
  <pre><code>$str = dirname(__FILE__);
  $str = str_replace('\\','/',$str);//since i'm using localhost for development, the paths contain backwards slahses so I replace them
  $str.='/';
  define('ROOT_DIR', $str);
  </code></pre>
  
  <p>And including everytinhg with php:</p>
  
  <pre><code>echo ROOT_DIR.'js/jquery';
  </code></pre>
  
  <p>But this aproach doesn't seem to work very well, even though the paths apear to be generated ok:</p>
  
  <pre><code>&lt;script src="C:/xampp/htdocs/Tzeny/js/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>My question is can you help me find another solution to include my files corectly or to make my solution work?</p>
  
  <p>For first pages it works, so:</p>
  
  <pre><code>Tzeny/Tutorials
  </code></pre>
  
  <p>works but</p>
  
  <pre><code>Tzeny/Tutorials/Categories/0
  </code></pre>
  
  <p>doesn't include anything. I used both /Tzeny/ and /. Any more ideas please? Or should I just go back to normal URLs?</p>