Help - Search - Members - Calendar
Full Version: Referencing from sub domains
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
KHalsey
I'm either trying to do the impossible or being stupid, either way, I'm driving myself nuts:

If I want to dispaly an image from a sub folder called icons in my root directory (its called public_html) then I am using this code and it works fine:

<img src="./icons/myicon.jpg">

However, when I have moved this all into a sub domain (i.e. all - including the folder "icons" - into another folder called subdomain) and use the same code it doesn't work. it does if I use a full url e.g.:

<img src="http://subdomain.mywebsite.com/icons/myicon.jpg">

but that seems crazy to have to do that.

Not sure if that makes sense. Say if not, and I'll try to switch off dsylexic mode.

Cheers
Keith
Darin McGrew
Please see the FAQ entry How can I avoid using the whole URL?
KHalsey
QUOTE(Darin McGrew @ Nov 9 2007, 05:40 PM) *

Please see the FAQ entry How can I avoid using the whole URL?


Thank you, most informative. My problem must lie else where then.
Darin McGrew
Can you provide the URL (address) of a document that demonstrates the problem?
pandy
QUOTE
My problem must lie else where then.

No, if I follow you correctly it is as it should be. The subdomain is the same thing as another domain in this context. ./icons will refer to a folder called icons inside your subdomain's webroot. Sounds like that's the folder named "subdomain".
Brian Chandler
QUOTE(pandy @ Nov 10 2007, 08:47 AM) *

QUOTE
My problem must lie else where then.

No, if I follow you correctly it is as it should be. The subdomain is the same thing as anothert domain in this context. ./icons will refer to a folder called icons inside your subdomain's webroot. Sounds like that's the folder named "subdomain".


Surely ./icons must refer to a directory 'icons' in the _current_ directory, since that's what '.' is?

Can someone remind: what does './xyz' do that 'xyz' doesn't? (I vaguely recall there was some point in writing it, but can't remember what...)
pandy
You are right. I didn't notice the dot even if I wrote it. My radar was set on a root relative URL. blush.gif
Darin McGrew
There isn't really any difference between href="./foo" and href="foo"

However, there is a difference between href="./" and href=""

Some people find it easier to get href="./" right if they also use href="./foo"
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.