![]() |
|
|
|
#1 |
|
Cheers,
I am somewhat confused over using relative paths, due to the fact that different web-servers seem to act differently. Is there a catch-all solution for relative paths? One host, if I use /index.htm or /tools/search.htm, it will always forever work. Another host, can't find graphics or folders. Another host, I always use ../index.htm or .../tools/search.htm, and it always works like a charm. It's driving me mad, new hosted domain today, which I haven't figured out yet. One minute it's fine, resolved, and next time it can't find a thing. HELP? Any relative paths are supposedly linked from the root folder. How do I determine the root folder? Does anyone know of any good tutorials on this particular nightmare? cc theo |
|
|
|
|
#2 |
|
Posts: n/a
|
theo wrote:
> Cheers, > I am somewhat confused over using relative paths, due to the fact that > different web-servers seem to act differently. Is there a catch-all > solution for relative paths? One host, if I use /index.htm or > /tools/search.htm, it will always forever work. Another host, can't find > graphics or folders. Another host, I always use ../index.htm or > ../tools/search.htm, and it always works like a charm. > It's driving me mad, new hosted domain today, which I haven't figured out > yet. One minute it's fine, resolved, and next time it can't find a thing. > HELP? Any relative paths are supposedly linked from the root folder. How > do I determine the root folder? Does anyone know of any good tutorials on > this particular nightmare? > > cc There is a similar issue with upper-case/lower-case where the obvious solution is to care for case-sensitivity. This means that extra caution is needed and on a Window$ host there is no way of testing this for guaranteed robustness. As for paths, you should always be fine with "../tools/search.htm", for example. This should always be relative to the current page. Having said that, some crawlers are too (shall I say?) stupid to handle this properly. Also, this induces a big cost when moving pages around and changing levelling. It's a clear case of trade-offs. The best you can do is stick to one host and not migrate too much. Roy -- Roy Schestowitz http://schestowitz.com |
|
|
|
#3 |
|
Posts: n/a
|
theo wrote:
> I am somewhat confused over using relative paths, due to the fact that > different web-servers seem to act differently. No they don't. Relative URLs aren't even interpreted by the server -- they're interpreted by the browser. The browser *always* requests absolute URLs from the server. The web server *only* has to deal with absolute URLs. > One host, if I use /index.htm or /tools/search.htm, it will always > forever work. Another host, can't find graphics or folders. Another > host, I always use ../index.htm or ../tools/search.htm, and it always > works like a charm. Then I'm guessing you do not correctly understand the difference between "../index.htm" and "/index.htm". The first means "find 'index.htm' in the directory above the current directory. The latter means "fine 'index.htm' in the top directory". If you are in the "first layer" of subdirectories, both will mean the same. Otherwise, they'll each do different things. -- Toby A Inkster BSc (Hons) ARCS Contact Me ~ http://tobyinkster.co.uk/contact |
|
|
|
#4 |
|
Posts: n/a
|
> > HELP? Any relative paths are supposedly linked from the root folder.
How > > do I determine the root folder? Does anyone know of any good tutorials on > > this particular nightmare? > > > > cc > > As for paths, you should always be fine with "../tools/search.htm", for > example. This should always be relative to the current page. Having said > that, some crawlers are too (shall I say?) stupid to handle this properly. > Also, this induces a big cost when moving pages around and changing > levelling. It's a clear case of trade-offs. The best you can do is stick to > one host and not migrate too much. > > Roy > Roy, Thanks for your input. I use templates, and so I can't program each page, need a relative url to the entire site, to the "parent directory". The .../tools/search.htm works well most of the time. Dreamweaver usually does it this way, but lately I've run into sites which don't. Either linux or win is the problem, or possibly an issue with quote, "parent directory". I haven't figured that out yet, and am wondering how to tackle this issue. Thanks, cc |
|
|
|
#5 |
|
Posts: n/a
|
> in the top directory". If you are in the "first layer" of subdirectories, > both will mean the same. Otherwise, they'll each do different things. > > -- > Toby A Inkster BSc (Hons) ARCS > Toby, Directnic hosts 4 of my domains, and / whatever always strips you down to the parent directory. /index.htm, from any page at any level, will take you to the first level index file. I know, it's supposed that the browser handles all of this, but why does this only work with directnic? I've beat myself down, made a page with 50 links, put it in 4 levels, with .../ with / with ../../ trying to find out how to make other sites work the same. The slashes and dots do strip you down, but not to the point where the same relative link is understood at all levels. Leaves me in the position that you speak of, that each link on every page, has to be specific and relative, not to the parent level, but to the present level. Directnic: Maybe I should be asking them... thanks.... cc |
|
|
|
#6 |
|
Posts: n/a
|
> Then I'm guessing you do not correctly understand the difference between
> "../index.htm" and "/index.htm". The first means "find 'index.htm' in the > directory above the current directory. The latter means "fine 'index.htm' > in the top directory". If you are in the "first layer" of subdirectories, > both will mean the same. Otherwise, they'll each do different things. > > -- > Toby A Inkster BSc (Hons) ARCS > Contact Me ~ http://tobyinkster.co.uk/contact > Cheers, I finally figured the situation. My host, if you enter any bad path, you'll be instantly brought to the index.htm The root directory only has one file, which is the index.htm, and the entire site only has two levels in directory structure. This explains my scenerio, that /anything/anything.htm or /anything.htm will always get you there. In this case, it's the server which gets you there, and not the browser, but due to the structure of the site. I tried http://tobyinkster.co.uk/go.htm and it brings me to a 404 page. With my site, you'll never ever see a 404, but the index instead. Thanks, cc |
|
|
|
#7 |
|
Posts: n/a
|
Some relevant info:
URLs (URIs), relative and absolute: http://webtips.dan.info/url.html Directories and Default Index Files: http://webtips.dan.info/subdir.html |
|
|
|
#8 |
|
Posts: n/a
|
"Dan" <> wrote in message news: oups.com... > Some relevant info: > > URLs (URIs), relative and absolute: > http://webtips.dan.info/url.html > > Directories and Default Index Files: > http://webtips.dan.info/subdir.html > +++ A URL with a slash at the start, like "/dir1/dir2/stuff.html", +++ references a page at a path starting from the root of the server. +++ To be more precise, it starts at the root of the domain name you're in. Thanks Dan, The path relative to server root was what I was looking for, which I'm not sure that Toby mentioned. Wasn't interested in climbing up or down notches in the tree. I'm still having problems with one domain, actually a sub-domain, where the root-relative relative paths don't seem to work. I haven't figured the root, quite yet. Paste follows: __________________________________ Thank you for using the directNIC.com Trouble Ticket System. The following response is from a qualified directNIC customer support team member: Date: 02/07/05 01:36pm From: mbrunson directNIC's links should be the same as any other webserver, since it's more a function of the client software. There are several ways to refer to a page on your site. Let's say you're on the page: http://example.com/family/picnic/photo.html And want to link to a page: http://example.com/fun/car/engine.html You could add the link in a couple ways, such as: http://example.com/fun/car/engine.html (absolute link) /fun/car/engine.html (relative to the root) .../../fun/car/engine.html (relative to the page you are on) If you wanted to link to a page in the same directory, let's say: http://example.com/family/picnic/menu.html You could do this with the following: http://example.com/family/picnic/menu.html (absolute link) /family/picnic/menu.html (relative to the root) ../menu.html (relative the the current page) menu.html (relative the the current page the "./" is inferred) paste ends +++++++++++++++++++++++++++ Thanks, cc |
|
|
|
#9 |
|
Posts: n/a
|
I also tried to clairify/change/alter the server root by adding this base tag into the head, but no dice either. <base href=http://www.domainname.com/subdomains/> <base href=http://www.domainname.com/subdomains> cc |
|
|
|
#10 |
|
Posts: n/a
|
theo wrote: > I'm still having problems with one domain, actually a sub-domain, > where the root-relative relative paths don't seem to work. I haven't > figured > the root, quite yet. I'm not sure I understand your problem. A subdomain is just like any other domain, except it's third-level (or more) instead of second-level, so that if you have the domain bar.net, you can use subdomains like foo.bar.net. The principles behind how they work on the Web are the same as for "regular" domains. If the server is configured so that foo.bar.net serves the main index file out of some directory on the server (maybe a different one from where the main domain bar.net is served out of), then that directory is the "root" as far as URLs in that subdomain are concerned. -- Dan |
|