Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

DOCUMENT ROOT on Local Server Using XAMPP

11:08 am on Aug 22, 2013 (gmt 0)

Junior Member

joined:June 10, 2013
votes: 0

How do I add a trailing slash to my htdocs folder (C:\xampp\htdocs)?

On my live production site I can include files like:


which works fine, but on localhost the server looks for:


I've edited the local httpd.conf file (added the trailing slash to DocumentRoot "C:/xampp/htdocs/" and <Directory "C:/xampp/htdocs/">) and tried some rewrite rules (even if I could get my head round regex, would this work anyway?) in htaccess without success.

This only affects files referenced using DOCUMENT_ROOT.


[edited by: phranque at 10:06 pm (utc) on Aug 27, 2013]
[edit reason] disabled graphic smileys [/edit]

5:27 am on Aug 25, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:July 19, 2013
votes: 0


That's interesting -- I've given up on "local servers" and only use production servers, but I have include($_SERVER["DOCUMENT_ROOT"].'/foo/foo.php'); on all of them, which I believe is how it should be [or at least it's been that way on every production box I can remember] and makes sense technically according to the docs.

DOCUMENT_ROOT should be:

The document root directory under which the current script is executing, as defined in the server's configuration file.


Technically /the-path/to-the-file/ is the path of the defined index file of the directory, not the path of the root directory the current file is running under.
8:12 am on Aug 25, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
votes: 352

:: detour to check my own files ::


Huh. Mine all say

include ($_SERVER['DOCUMENT_ROOT'] . "/foo/foo.php");

with leading slash. Works identically on MAMP and live server.