HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 19. FIRST WEBSITE 210


when you visit that directory you can see a list of all those files. Normally
they are linked for easy access.


19.6.2 index.html


There is a hugely important exception to directory browsing.


Exam Question 340(p.356): What is the default file name for webpages
on an Apache server?
Required Answer:index.html


If one of the files in the directory is namedindex, as inindex.htmlor
index.htmorindex.cgiorindex.php, Apache will assume that file will
do the work of showing the index. Apache will simply show that file instead
of creating an index.


Frequently the index file does not show an “index” at all. Instead, it is the
main html file to be shown, or is the cgi script to be run. The other files in
that directory are images or style sheets that support the main file.


This is the way we recommend you use it. For each webpage you have,
create a directory. Then call the html fileindex.htmland include with it
the css files and media files that it will use.


There is a priority order that is followed if more than one index file exists.
This is specified in the Apache configuration file. Normallyindex.htmlhas
precedence. After that we getindex.htm, and still laterindex.cgi. The
one with the highest priority gets displayed. The others get ignored.


There may be other special filenames, likedefault.html, that act like in-
dex.html does.


Be aware thatindexandIndexare not the same. Exact spelling is impor-
tant. You must use lower-case letters.


19.7 Publishing and Backing Up


Publishing is the act of copying content from your local master copy (offline)
to your webhosting server (online).


Backing up is the act of copying content from your webhosting server (online)
to a local backup copy (offline).

Free download pdf