Return
to Table of Contents
Server
Side Includes (SSI)
Customize
Missing Docs Page
Mime
Types
.htaccess
Wireless
Application Protocol (WAP)
Cron
Jobs
Real
Audio/Video
Server
Side Includes (SSI)
Your domain is capable
of supporting the use of SSI. In order for the system to process
the include, you
must save the page with a .shtml, .sht or .shtm extension
rather than a .htm or .html extension. A sample SSI would be:
<!--#exec
cgi="cgi-bin/footer.cgi"-->
NOTE:
As shown in the
example above, the URL must be relative and not a full call. The following
would not work:
<!--#exec
cgi="http://yourdomain.com/cgi-bin/footer.cgi"-->
These are the five other SSI commands available and what they do:
config
- sets the error-message format, time, or size
echo
- inserts the variable values of an SSI into your web page
flastmod
- inserts a date/time stamp of when a file was last updated
fsize
- will insert the size of a file into your web page
include
- insert the content of an HTML file into your web page.
-
inserting the following
tag in your .shtml page where you want the date and time inserted using
the flastmod SSI command.
<!--#flastmod
file="filename.shtml" -->
This will return
the result in the default date format (Note: the SSI will return the local
time zone of the SERVER you are using, not YOUR timezone where you work
on your
pages):
Tuesday, 19-Oct-1999
10:14:12 EST
-
Use the time format
(timefmt) to just include the date without the time.
<!--#config timefmt="%x"
-->
<!--#flastmod
file="filename.shtml" -->
This will result
in the format:
10/19/99
-
To mix the format around
use the date code above. For example to create just the month and year,
use the following SSI command:
<!--#config timefmt="%B
%Y" -->
<!--#flastmod
file="filename.shtml" -->
This will result
in the format:
October 1999
-
You can also configure
that vexing message that says "an error has occured while processing this
directive" by using the config errmsg argument. Maybe you don't want
your surfers to know if you have an SSI problem so you could include an
error message that says "Have a great day!" and then if you saw that on
your page you would
know that actually
means there is a problem with your SSI tag.
<!--#config errmsg="You
can put any message you want to here" -->
-
Probably the most useful
SSI command is include which will allow you to include signature files
to pages, or even to combine and build full SHTML pages out of several
different pages. For example, say you want to include a legal copyright
notice at the bottom of every page. You could just type it in, or cut and
paste to every page, but there is an easier way using SSI, plus you can
change all pages with the SSI call by just modifying one file. Cool, huh?
Let's create an
HTML (not SHTML) file and save the completed file as copyright.html with
only the words Copyright 1999 yourcompany, inc. Your HTML should look something
like this:
<html><head></head><body>
<p>Copyright
1999 Yourcompany, INC.</p>
</body></html>
Now save
copyright.html in a directory named test on your website. Create an SSI
include on an SHTML page inside the same directory by typing:
<!--#include file="copyright.html"
-->
And now
on each page inside the same test directory you put the above tag you will
see:
Copyright 1999 Yourcompany,
INC
-
But what if you want to do an
SSI include on pages outside the test directory? If it is a subdirectory
of test, then you are ok with the existing file argument, but if it is
in any other directory outside of test then you will need to use the virtual
argument instead. The virtual argument is used to begin the search for
files from the ROOT level. The ROOT level is the basically the place where
you start putting your www files. When you just type your domain into the
browser it pulls up the index file (by default) in your ROOT level. Therefore
the ROOT level path to the test directory would be: /test/copyright.html
Why is the virtual argument
important? Well, in order to include a file you have to use the right path
to it. You might compare this conceptually to using an IMG tag in your
HTML programming and selecting the correct path to your image. If you don't
get the path to your image correct then you will be greeted by a broken
link. Now lets construct the SSI include tag using the virtual argument:
<!--#include virtual="/test/copyright.html"
-->
Customize
Missing Docs Page
A file already exists
in your www directory. It's called missing.html. You can edit it
to your liking, or create your own. As long as it's called missing.html
and is in your root www directory, the server will display it whenever
someone tries to access a page on your domain that does not exist.
NOTE:
In order for Microsoft
Internet Explorer (MSIE) to display the missing.html page, the file has
to be at least 5k in size.
Mime
Types
MIME types ( Multipurpose
Internet Mail Extensions ) help the server inform the browser what type
of content is being received, so it can load the appropriate plug-ins and
such. Our servers are configured by default for all popular MIME types.
However, Apache's "AddType" directive offers you the ability to immediately
add any MIME types that you might need to your account.
The following is an example
of the "AddType" directive:
----------- BEGIN .htaccess
---------
AddType application/x-shockwave-flash
swf
----------- END .htaccess
----------
NOTE: The Flash MIME type
is actually preconfigured for your use -- it is included here for example
purposes only.
Many mime types
are already supported on the server, however you can add more or customize
your site to overide the default settings that we have set up.
.htaccess in your home directory
(full path: /home/domain) will control your entire site. You can also place
them in subdirectories, in which case the file will control only files
under that subdirectory. The .htaccess file can be created on the server
while logged in via telnet/ssh/plusmail, or created locally and uploaded
in ASCII mode via FTP> -- whichever you prefer.
Below are some common tricks
used to improve customer web sites:
Custom Error Pages
Apache allows you the ability
to replace the default error message pages with pages of your own design.
Doing so is as simple as creating the pages and adding one directive for
each type of error to your .htaccess file.
The most common error page
is the "404 File Not Found" error generated when a user tries to access
a non-existent URL at your site. If your domain was example.com and you
created the page http://www.example.com/errors/404.html to replace the
default page, you would add the following directive to your .htaccess file:
ErrorDocument 404 /errors/404.html
This directive uses "relative addressing"
(e.g. the http://www.example.com is removed, as Apache already knows the
domain name of your site).
NOTE: This is an example.
Your 404 File Not Found page can easily be modfied by editing your missing.html
file located in your www directory.
Other common error messages
you might wish to replace are the "500 Internal Server" error that results
when a CGI script crashes, and the "401 Authorization Required" error that
occurs when, for instance, someone tries to access a password
protected directory without a proper username. If you followed the
same file naming conventions as the above example, your directives might
look like:
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
An explanation of each error code:
404 - File Not Found
500 - Internal Server Error
401 - Unauthorized
403 - Forbidden
Changing the Default File
When a URL specifying only
a directory is requested (e.g. http://www.example.com/directory/), Apache
looks for files with these names (in the order they appear):
index.html
index.shtml
index.htm
index.php
index.php3
index.phtml
index.cgi
The .htaccess directive "DirectoryIndex"
can be used to override this behavior. For instance, say you have files
named index.html and index.php3. Using the default, index.html will be
returned because it's searched for first. By placing the line:
DirectoryIndex index.php index.html
in your .htaccess file, you can force
Apache to look for index.php first and look for index.html only if there
is no index.php file present.
"DirectoryIndex" can be used
to make any file you'd like the default -- there is nothing requiring you
to use the default set of filenames. For instance, you could have:
DirectoryIndex firstpage.html first.html first.php
and the web server would first look
for firstpage.html, first.html, and first.php, returning a directory listing
if none of those files were present in the directory.
Allowing Directory Listings
By default, the server is
configured not to allow directory listings, i.e. your visitors are not
able to view directory contents that do not contain an index.html file.
This behavior can be changed with the "Options
+Indexes" directive.
To view all files in a directory that does not contain an index page, create
a .htaccess file in that directory with the following directive:
<Limit GET>
Options +Indexes
</Limit>
For more information about
MIME types please follow this link: http://www.oac.uci.edu/indiv/ehood/MIME/MIME.html
NOTE: If you have
FrontPage extensions installed, Mime types should be added using FrontPage's
method instead. See Microsoft's
site for more information.
.htaccess
There may be times where you want to refuse
access to certain robots or human visitors to your web site.
1. Basic .htaccess file
order allow,deny
deny from 127.0.0.1
allow from all
|
|
This will refuse all GET and POST requests made
by IP address 127.0.0.1, an error message is shown
instead.
2. More options
To block multiple IP addresses, list them one per
line.
order allow,deny
deny from 127.0.0.1
deny from 127.0.0.2
deny from 127.0.0.3
allow from all
|
|
You can also block an entire IP block/range. Here
we will not specify the last octet in the .htaccess file.
This will refuse access for any user with an
address in the 127.0.0.0 to 127.0.0.255 range.
Instead of using numeric addresses, domain names
(and subdomain names) can be used to ban users.
It bans users with a remote hostname ending in isp_name.com.
This would stop all users connected to the internet via isp_name.com
from viewing your site.
Using .htaccess to block an entire range or name
is likely to lock out innocent users. Use with caution.
Wireless
Application Protocol (WAP)
WAP and XML MIME
types are configured on our servers, and can be used with any account.
WAP allows mobile and wireless devices to browse Web pages in a specialized
format called Wireless Markup Language (WML). Telephone service providers
all over the world are quickly establishing WAP portals for their customers,
and Web portals are launching adaptations of their Web service targetted
for the new wireless access methods. More Detailed Information:
http://wap.org
http://wap.com
Cron
Jobs
Cron is the ability
to run a program based on the system clock. We allow up to one operation
per day between the hours of 12:00 a.m. and 8:00 a.m. We will need to enable
this for your domain. Please send an e-mail to support to request this.
In your e-mail, include the following:
-
your domain name
-
the url to your script
-
a brief description
of what the script does
-
the time you want the
script to run (time must be between 12:00 a.m. and 8:00 a.m.)
Real Audio/Real
Video (available on qualifying accounts)
How do I use HTTP streaming
for RealAudio and/or RealVideo?
The HTTP protocol enables
audio and video content providers to stream
RealAudio and RealVideo
from a World Wide Web server.
To stream RealMedia content
using HTTP:
1. Upload your encoded RealAudio
or RealVideo files (files with the .ra
or .rm extensions)
to your realaudio directory. **UPLOAD IN BINARY MODE**
2. Use a text editor (such
as Notepad) to create a metafile containing
a RealAudio
URL.
For example, the contents
of your file should be in the following
form:
http://yourdomain.com/realaudio/file.ra
or
http://yourdomain.com/realaudio/file.rm
3. Save your metafile
in as text using a .ram filename extension. **UPLOAD IN ASCII MODE**
4. In your HTML document,
reference the metafile in a hyperlink.
For example:
<A
HREF="filename.ram">
or
<A
HREF="http://yourdomain.com/file.ram">
*Please note: The tag should
not be used in your metafile.
5. When a user clicks
on the link, the audio file(s) begin to download.
The RealAudio
Player begins playing after a few seconds; it does
not need
to wait for the entire file to be downloaded.
|