For refference directories are the same as folders, and I call them dir(s) for short.
Tip: A real folder on your computer, once uploaded, is now a directory on your site.
Tip: Your site should have the same file structure as the sites files on your computer. (Or vice versa) This way it is easier to do backups, changes or restorations.
A tip about index pages:
index.html is the default file that will load first on my server.
Some web sites have index.htm as default. (ask your webhost) This is called a file hierarchy.
If I have an index.html page and a index.php page in the
same dir, you will see the default index.html page, unless I use the whole url of
OR remove the index.html page entirely, thus making the index.php page the default.
So whatever I want someone to see in a dir first, is what I name 'index'.
The file extension is up to you, but be aware of the file hierarchy for your site.
This page http://webhosting.mypagesonline.com/
is really a index.php page in a folder called webhosting. I like the look better than
You can also use htaccess to change the default settings, and make any page you wish to be the default page in a dir.
I use what I call 'dummy' index files in folders where there is no index file, so a nosy
person can't see what is in there.
I find a lot of people put their images in a folder called images, and if you go to
http://theirsite.com/images/ you will be in their images folder and be able to see all
the images they have for the whole site in there. So, I put a basic "redirect to the home
page" index page in all dirs that don't have a real index page, such as image folders.
For an example of a folder without a index file, go here:
For an example of one of my dummy index files, try this one:
I use that dir solely for remote linking which is very likely to experience some curious
vistors smart enough to right click and veiw the properties of my remotely linked pics.
Notice I did not name it 'images', 'pics', 'gifs' or some other likely target.
Try this one:
and you get a forbidden. I have a dummy index file in there, but I didn't chmod it to
readable. Neat huh?
Now for images, I use them relatively, by either putting them in the dir of the actual
pages, themselves or in a subdir within that dir. they load quicker because the browser
doesn't have to call out on the net "http://thesite/resolvetheip/thenfindthedir/nameofpic.jpg"
for each image displayed.
By making the link "nameofpic.jpg" it tells the browser that the
image is right where that page is, therefore speedier loading. and like I said this way,
there is probably already a index page in that dir, so you don't need a dummy index page
like you would with a file containing only images, and no html files.
If there are a lot of images I make a sub dir and call the pics from there "sub/image.jpg"
Now the browser knows to look one dir deeper in the file structure to find the image.
I put my dummy files in a folder called error on my Hard Drive so I don't accidently upload
that index file into the wrong one thus re writing a real index file.
Speaking of file overwrites:
If you have a file called "sample.html" and you upload a file with the same name (called
"sample.html") it will overwrite the first one, provided you upload it into the same dir
as the first one. We actually have many index files on our site, and yes, I have, by
accident, uploaded one into the wrong dir, rewriting the original index located there,
but all I had to do was upload the right index file for that dir, to fix it.
So basically a dummy file can be anything you want. It can even be a simple html message:
"Warning, you are trying to access a file that is none of your business.
Your IP has been logged!"
Just as long as you name it index.html, or whatever the default is for your server.
There are more secure ways, such as htaccess, but this one is very simple and works.
and many hosts (mostly free ones) do not have htaccess.