I'm tired of having all my files under one folder. (It's getting confusing).
So, my question is...
Is it better to use ../../../index.html
or
websiteaddress.com/index.html
when using URLs.
I'd like to know which is the quickest and most efficient, and is using a lot of ../../../index.html bad.
Princess






disaster-master posted this at 23:14 — 1st November 2002.
She has: 2,152 posts
Joined: May 2001
You can really do this any way that works best for you. For example, if you have a site about web design and the URL is webdesign.com
The subjects on your site are HTML, CSS, javascript and contact page.
You can do the following:
webdesign.com/
webdesign.com/html/index.html
webdesign.com/css/index.html
webdesign.com/javascript/index.html
webdesign.com/contact/index.html
Sonia
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming -- WOW--What a Ride!!!"
Princess4ubabe posted this at 23:46 — 1st November 2002.
They have: 25 posts
Joined: Nov 2002
Sorry, I didn't make myself very clear.
or

Say I'm on page webdesign.com/html/index.html and I want to include a picture on that page, but it's not in my "html" folder, it's in the main folder. Therefore, I'd have to use either
I'd like to use the ../../ concept, but it looks like I'll have to use a lot. Is that bad?
Megan posted this at 00:55 — 2nd November 2002.
She has: 10,288 posts
Joined: Jun 1999
No, not really. You could go either way, and it's debatable as to which method is best. Normally the ../ method is best, but sometimes a full URL is just easier, especially if you're using server generated includes for navigation.
Megan
My web design blog
Suzanne posted this at 02:23 — 2nd November 2002.
She has: 5,512 posts
Joined: Feb 2000
Actually, there are three options:
relative: ../images/whatever.gif
absolute: http://www.domain.com/images/whatever.gif
relative to root: /images/whatever.gif
On most servers, if you use the forward slash first, it means "go to the root and then follow this path", or in this case, go up to domain.com, then go to the images folder and get the whatever.gif.
love me, love my brain :: iStockphoto portfolio
Busy posted this at 02:35 — 2nd November 2002.
He has: 6,157 posts
Joined: May 2001
I remember reading ages ago using the full URL is bad for images etc, the server has to go out of your site then back in to get the image, where as using ../ or whatever the server only goes back or forwards within your sites space.
I suppose a few images wouldnt be bad but image intense sites does get slowed down a lil.
Also if people save your source, they can view your site with images off line, so you'd need .htaccess to pervent hot linking.
A good file system like disaster-master mentioned (without the index.html) is a good clean way to set them up, keep the .html files in the main directory, keep all images in a folder called "images" or "graphics" or something, javascript and CSS could go anywhere, don;t usually have many of them and what other files you have left in another folder.
<?bhb if(broken){ echo("It wasn't me
"); } ?>
Learn HTML the ez way - EzHTML.net
Some people are like slinkies, they dont really serve any purpose but they still bring a smile to your face when you push them down the stairs ...
Suzanne posted this at 03:11 — 2nd November 2002.
She has: 5,512 posts
Joined: Feb 2000
The full url is more work, yes. Relative to root isn't particularly different from relative, other than you have less ../../ to remember.
And it works WAY better for CSS to use relative to root urls.
Blocking viewing images outside of the html page is excellent, so is blocking them being loaded from other urls, and you can also use .htaccess to set the index file for any folder, so it could be any file as the one that shows, including a "you cannot view these files" image, or better yet, either a redirect to the right place where they CAN view files, or a page with the site map on it, to help them get where they are going.
love me, love my brain :: iStockphoto portfolio
Princess4ubabe posted this at 16:39 — 4th November 2002.
They have: 25 posts
Joined: Nov 2002
Thanks everyone.
What is .htaccess?
ROB posted this at 18:48 — 4th November 2002.
They have: 447 posts
Joined: Oct 1999
also keep in mind that if you use absolute urls you cant move your site without editing every anchor,image and link in every page. it also increases the filesizes, and may (im not sure) cause a dns lookup for every page.
best to use relative urls. then you can just copy your site to anywhere and it will work fine with no modification.
dk01 posted this at 22:02 — 4th November 2002.
He has: 517 posts
Joined: Mar 2002
Same with relative to root also rob. I think thats what you mean but just to clarify.
-dk
jammin posted this at 22:58 — 4th November 2002.
They have: 222 posts
Joined: Sep 2002
hmm... i have always kept my html files in the main directory, any javascript or css in a subfolder, and another subfolder for images. seems to work for me... but then again it can get fairly cluttered if you have alot of html files.
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
Renegade posted this at 00:58 — 5th November 2002.
He has: 2,944 posts
Joined: Oct 2002
yeah, i always find that relative is better, and eisier because less typing, faster to load, and lesstyping
Cheng Eu Chew - Renegade
Download:
- Mozilla, Firefox
- Opera
This post may contain peanut traces
hagar posted this at 00:59 — 5th November 2002.
They have: 104 posts
Joined: Oct 2002
i usually use one folder under root for includes, one under root for images, sub folders under includes for back end code, and point everything relative to root then into those folders to obtain my includes, images, javascript, WSH, whathaveyou.
When you have maybe 80+ subfolders just with content and documents in them(Like I often do), one place to aim your links at can help alot, especially if your domain name changes at all. Hardcoded domain links are usually a problem waiting to happen. ../../.. links can be an even bigger pain if your structure ever changes. Best to build around the concept that the site will be massive and use practices that make it easy to maintain, rather then think small, grow, and then weep over poor planning.
my $0.02 worth + Tax;)
"I ’ll make thee glorious by my pen, And famous by my sword." - James Graham, Marquess of Montrose (1612–1650)
Renegade posted this at 08:22 — 6th November 2002.
He has: 2,944 posts
Joined: Oct 2002
yeah good point hager, i've been down that road b4, now i use sub folders i.e css,js,images....