Page 1 of 1

Ptoblem with "/" or root directory.

PostPosted: 19. June 2011 10:10
by syn1st3rx
I'm pretty sure this is a common question:

I've been using XAMPP for about a month now, switching over from AppServ. (Loving it BTW).

However i cant seem to get my paths to link to my root directory when i use a forward slash before the path name "/file.php" (example) on my localhost. It works fine when i upload to my online server but i dont wanna have to keep uploading to debug.

PLEASE HELP!

Re: Ptoblem with "/" or root directory.

PostPosted: 19. June 2011 10:41
by Nobbie

Re: Ptoblem with "/" or root directory.

PostPosted: 19. June 2011 12:16
by syn1st3rx
Thanks loads for the info.

I've however decided to use absolute paths for this. ie. http://localhost/directory/ and before uploading i'll simply do a find n replace with my actual domain name. ie http://www.domain.com/

Re: Ptoblem with "/" or root directory.

PostPosted: 19. June 2011 14:05
by WilliL
do you mean sth like this?
Code: Select all
<?php
// script heading
If (($_SERVER["DOCUMENT_ROOT"] == "C:/xampp/htdocs") ? $rootpath = "C:/xampp/htdocs" : $rootpath = "/HOST_ROOT");
$inc_path = $rootpath."/inc";
require_once ($inc_path."/common_settings.php" ); //setting main parameter used in scripts, depending on xampp or hosted
// other script
?>

hint: internal links are differnt too