Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Absolute paths fight with URL subdirectory

Status
Not open for further replies.

OsakaWebbie

Programmer
Feb 11, 2003
628
0
0
JP
I am trying to move a site to a new hoster, and of course I want to make sure everything works before I point the domain's DNS entries to the new location. But it's a shared hoster whose structure is different from hosters I'm used to - they don't issue you an IP address that is your HTML root directory, but instead, the pre-domain-name URL is a shared domain (or IP) plus a personal subdirectory. My code is complex, and some file paths are absolute in relation to the document root, and of course they all break. Two questions:
[ol][li]When I point my domain name to the site eventually, will these paths get well, or do I need to change everything to relative paths (which I don't really want to do) or find a hoster that lets me have a document root?[/li]
[li]If the paths will work right when the domain name comes, is there anything I can do in the meantime to test the code? Server software versions are very different, so extensive testing is needed. I was wondering if an entry in my local PC's hosts file or something might work to force it to look like an HTML root just for me, but I have never done something like that to point to an external site with a subdirectory, and I can't find anything relevent searching the web.[/li][/ol]
Thanks in advance for your help.
 
For local testing, virtual directories are the way to go. Get a local webserver installed and running (I'm an Apache fan), and check the documentation for the webserver you chose for configuring virtual directories. Once your virtual directory is setup, loads your site.

The way most hoster's setup shared hosting is through virtual directories and personal subdirectories; therefore, when your DNS are repointed, the hoster configures a virtual directory to respond to your hostname, and the webserver is directed appropriately.

Your document root will end up being your personal subdirectory ... and if the hoster configured your site correctly, you "should" be jailed from going any higher in the directory structure.

And now ... I personally think this post should have been posted in one of the Webserver forums, or the DNS/BIND/DHCP/WINS Issues forum ... but that's just my opinion. ;)


Greg
 
Sorry if I posted in the wrong place - I was thinking it was an issue of the paths in my code, which would be an HTML question, but I suppose it is more in the area of admin. Perhaps that's why it took a week to get a response - usually Tek-tips people are fast.

I know about local testing and virtual directories, and I have them on my own PC, but this question was regarding testing on the hoster, where I can't write my own virtual directories (no access to their config files). At this point, I have already done the first of several domains that will go through this process. I discovered that there were not as many absolute paths as I thought there were, so I decided to go ahead and change them to relative, and I have already moved the DNS. There are a couple paths that I am not sure of (various files call other files, and in the end I'm not sure which directory the path is relative to), but they relate to a third-party component I can live without for awhile, until I figure out the answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top