Windows iTOps Tube

Monday, May 7, 2012

Path conflicts between hosted site and dev site

I have a development server and a hosted server that are running the same code/pages. When I upload my code from the dev server to the hosted server the code breaks because the file structure (path) changes. For example...

to reference my index page on my dev server, I would use...
"localhost/index.php"

to reference my index page on my hosted site, I would use...
"hostedserver. com/~myHome/index.php"

In this example, I have to add in "~myHome" as part of the webroot directory on the hosted site. If the problem only affected the index.php page, I could just write a different index.php file for each server, but paths are reflected in so many other pages so thats not practical. How can I get my code to automatically know which server its running on to know which path to use?

Thanks in advance!

Jay

Topic Replies: 1



0 comments:

Post a Comment