Starlight Site Operating
Manual | Understanding
the web site file system:
index.html
and why you should use it:
This again is where a number of newer webmasters
become stumped. They upload all of their files and directories, and
then want to access them with their browser, but forgetting to create
their welcoming page as index.html, so here's what happens: They access
their site as http://www.mydomain.com
or using the associated IP number, for example, http://
216.74.122.26, and what they see is their entire file directory
structure! Yikes!
It looks just like exploring the C drive on
your computer! You don't want visitors seeing that, do you?
When you access your site by calling it as http://www.mydomain.com
or the assigned IP (for example), http:// 216.74.122.26/,
the web server looks for the "index.html" file as the (default
file) to be sent to visitors, and thus this is why http://www.mydomain.com/
by itself will automatically display the home or welcoming page. It's
because the server automatically looks for index.html whenever a domain
or directory is called without a filename appended to it such as this,
http://www.mydomain.com/file.html
If it can't find index.html, it will simply list "your entire web
directory" to everyone that access's it, which is a MAJOR security
risk! ALWAYS, use an "index.html" file in any directory you
create, including your "root" web directory. In general, it's
always a good idea to use "index.html" as your main page in
"all sub-directories" of your account. Forgetting to place
an index.html in your root web, or any subdirectory of your web for
that matter will effectively leave all of its contents viewable to the
world.
Understanding
case sensitivity:
Another small detail, which can throw many
newer users into a tailspin: unlike your local PC, the Unix file system
is very particular about "uppercase" and "lowercase"
file names. For example, if you were to name a picture file "me.jpg,"
then this is what you must call it in your HTML. Referencing it
as "me.JPG," (observe the uppercase) tells a Unix web server
to treat it as a totally different file name.
Unix file servers are exceptionally fussy on this issue, so make sure
you pay close attention to "case' when uploading files, or installing
and configuring cgi based scripts. The same rule applies for all files
including your .html pages. Again, the server treats .html and .HTML
as two entirely different files. Want to keep in simple? Try to stick
with lowercase letters in all file names and extensions.
Uploading your
files in the correct mode (ASCII or Binary)?
Uploading in the wrong format for images or binaries will result in
a strange mess appearing in place of the file. For CGI scripts,
this mistake has to be the most common cause of that annoying error
known as the (Server 500 Error - Malformed Headers), or something to
that lovely extent. While this can be the result of many various programming
errors, the most popular amongst new users are uploading their scripts
in the "WRONG" format. Your cgi scripts "MUST" always
be uploaded in ASCII mode. Alternatively, if you upload an image or
.exe file, it must be done in "BINARY" mode.
The difference
between ASCII and BINARY?
In short, html or text based files are supposed to be transferred in
ASCII mode. Uploading them in Binary mode will append ^M's to the end
of every line. In most cases, this is OK, with html files because your
browser will ignore them. BUT, with other text files such as cgi scripts,
uploading them in binary will damage them, thus causing a (server 500
error). This is because binary mode has added ^M's to the end of every
line, which are not supposed to be in the program. This of course, is
what causes the additional message of (Malformed Headers), which often
displays at the bottom of the "Server 500" message when a
CGI script has crashed.
Once again, BINARY mode is used for transferring executable programs,
compressed files and all image/picture files. If you try to upload an
image in ASCII mode, you observer a strange mess appearing on the page
where the image is suppose to appear. ASCII mode in this case, has corrupted
the binary coding in the jpeg or gif image. If this happens, just re-upload
it in the Binary format.
Setting
your FTP client to automatically detect ASCII and Binary file transfers:
Most FTP programs have "AUTO" mode, which will tell the FTP
client to automatically detect the file type you're transferring and
will select the appropriate mode. By default, most FTP programs will
attempt to transfer everything in binary mode, but when "Automatic"
is selected, the FTP client will check a list of known ASCII extensions,
(for example, .pl, .cgi, .txt). If it detects one of these extensions,
it automatically switches to ASCII mode.
By Default, most of the well-known files to be uploaded in ASCII are
already entered, however you can manually add additional extensions
that you would like to transfer in ASCII mode by selecting the feature
called "Extensions." Here, you can any additional extensions
that will cause the FTP client to toggle to ASCII mode automatically
upon detecting an extension entered in its list. Remember, you must
set your transfer mode to "Automatic" for this to work.
File
types and what they represent:
Various file types can effect both the behavior of your files, as well
as how the server treats them. While there are numerous file extensions,
which represent a host of various file types, we'll stick to the basic
ones in this quick overview:
The .html file:
This is one is the most commonly used and the most one of you are already
familiar with. Html stands for (Hypertext Markup Language). Essentially,
it tells the server, as well as the clients browser to process and display
the .html coding in a way, which is meaningful to the end user through
a browser.
The .htm file:
Many of you have probably noticed this newer extension appearing in
place of the traditional .html one. In short, .htm is most often created,
and or generated from the Microsoft FrontPage web editor. The two are
essentially the same and provide the same basic purpose. Unless you're
using FrontPage, you will probably use the .html extension at the end
of your web pages.
The .gif and .jpg file:
Most commonly used because of its good compression in web page images.
Generally, .gif files are the fastest loading, as they remove a lot
of information, which is not required to maintain image integrity, but
to a point however. .jpg will allow more flexibility in compression
and quality settings, however can also result in larger files.
The .CGI and the .pl file:
.cgi and .pl are most often used for perl scripts. Perl scripts are
small text based programs, which are executed on the server end, and
will perform a host of interactive functions for a web site. In short,
when a .pl or .cgi file is called, it tells the server to process it
using the "Perl Interpreter." The Perl Interpreter understands
the programming within the script, and will perform the set of sub routines,
which will yield your desired effect. This desired effect could be anything
from a simple web page counter, to more complex programs such as discussion
forums, e-commerce platforms, to online auctions. In many cases, you
can download these "ready to go" scripts for free, and in
others you may have to purchase them.
|