fix preceding forward slash in php -


i trying create local copy of website installing same xampp version , downloading files , mysql.

on web server files saved @ http://www.website.com/html accessible through website.com

i made own in directory http://localhost/website.com/html

i having trouble script because css , javascript have preceding "/"

src="/js/prototype.js" 

i cant explain sample problem

the script have this

<link href="/_design/_master.css" rel="stylesheet" type="text/css">  

that doesn't work on local install works on online version. if remove first / on local install works.

<link href="_design/_master.css" rel="stylesheet" type="text/css"> 

this link works on online version

<a id="logout" href="/logout.php">logout</a> 

but on local version links http://localhost/logout.php supposed linking http://localhost/website.com/html/logout.php

when remove first / works how ever there many of them , might miss some.

is there setting php fixing this? or did put on wrong directory? please help. thanks!

ah problem. when have / first character assumes starting root directory, on local machine don't keep in root directory. if remove slash / should work on both computer , on real website.

first wrote: (

substr($string, 1) 

that function return string without first character, in case slash

edit: should have been $string, forgot variables in php have $

)


Comments