Path conflicts between hosted site and dev site

  • JonDoeCA
  • Newbie
  • Newbie
  • JonDoeCA
  • Posts: 7

Post 3+ Months Ago

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 that's not practical. How can I get my code to automatically know which server it's running on to know which path to use?

Thanks in advance!

Jay
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • JonDoeCA
  • Newbie
  • Newbie
  • JonDoeCA
  • Posts: 7

Post 3+ Months Ago

Nevermind, I was referencing a php page that was referencing another php page that was styled by a referenced css page. It was the css code that was breaking.

In short, I was doing this...
index.php ---> refPage.php ---> style.css

but should have been doing this...
index.php ---> refPage.php
index.php ---> style.css

I hope that makes sense because I don't know how else to write it. Doh! Anyway, there it is.
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6243
  • Loc: Seattle, WA

Post 3+ Months Ago

Glad to see you got it sorted out! Path issues can be tricky to debug, especially if/when they're being dynamically generated.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 119 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.