I got confused a little wondering how to link my images to their urls in each page. let me explain a little. I actually have this site structure:
------> folder1-1
------> folder1 ------> folder1-2
------> folder1-3
------> folder2-1
www.domain.com ------> main folder ------> folder2 ------> folder2-2
------> folder2-3
------> folder3-1
------> folder3 ------> folder3-2
------> folder3-3
when I get to linking images in each page things change; I mean I have to modify the url destination. for example, the main folder can get the images directly from the source so the url will look like this "../images/bla.jpg"
however, the further I go, the longer it gets; i.e: for folder2 : "../../images/bla.jpg"
and so on for the others...
I have my images folder in the root where main folder is placed so their are parallel to each other.
I found 4 ways to resolve this:
1- placing the full url to the link directly; i.e: "http://www.domain.com/images/bla.jpg" (I don't know yet if that effect the site speed; slowing it down or not)
2- going crazy and add ../../../
the further I go in the site (which I think none-sense.
3- bringing all folders in line "parallel to each other" so all of them are placed in the root an the image folder can pass directly to each page.
4- using external css file to contain all images I need for each page (but I think I will have to use the full url to connect it to each page or the same long ../../../
way)
Now my question is, Can I use images with my original structure without messing things directly to each page and without adding the full url?
Thanks
Yes, you should be able to use a leading slash to denote that the request starts from the root of the domain. So /images/bla.jpg
will translate to http://www.domain.com/images/bla.jpg
no matter how deeply you're nested.
As a side note, point number 1, using http://www.domain.com/images/bla.jpg
, won't affect speed in any way. No matter how the URL is phrased it'll be broken down by the browser and sent the same way.