title: How can I control DOCUMENT_ROOT to work on localhost and live server?
body: <p>To keep URLs working in version-controlled projects, I've been using $_SERVER['DOCUMENT_ROOT']. The problem is, I develop projects within a folder, so I get this: </p>
  
  <p>$_SERVER['DOCUMENT_ROOT'] . '/folder/path/to/file.php'</p>
  
  <p>When I go live, I generally simply want the following:</p>
  
  <p>$_SERVER['DOCUMENT_ROOT'] . '/path/to/file.php'</p>
  
  <p>I know there are bigger problems in the world than having to remove and add this folder name, but is there a way I can easily automate this? Can I somehow set my document root locally to include the folder I'm working in? Do I have a fundamental misunderstanding of the way things are working? Kind of new at this stuff, and looking to learn as much as possible and really grok the "why."</p>
  
  <p>Thanks so much!</p>