Technical Note 2 - Letting Apache serve SQ files
Web browsers (such as Netscape Communicator and Microsoft Internet Explorer) can
be configured to launch Sysquake or Sysquake Viewer when they download SQ files.
Then you can embed links to SQ files in your HTML documents so that the readers
have just to click them to have interactive graphics on their screen.
The browser knows what to do with files it downloads because it has a table
which relates file types (or MIME type) to actions. For instance, the MIME type
text/html, which indentifies HTML documents, makes the browser interprets the
HTML tags and display the result in its window. SQ files have been given the
MIME type application/x-sysquake (prefix x- is reserved for experimental types,
which do not have to be accepted by the World Wide Web Organization). Thus, associating
application/x-sysquake with Sysquake or Sysquake Viewer makes the browser react
the way we want.
This is only half of the problem, however. We should also instuct the HTTP server
(the program which delivers HTML and SQ files) to recognize SQ files and send
them as application/x-sysquake. This technical note explains how to configure
Apache, one of the most popular HTTP servers. If you do not do it, the default
MIME type will be used, which is usually text/html, and the browser will display
it as text in its window.
Apache recognize files by looking at their extensions, i.e. the characters
which follow the dot in their file name. There are three locations for the
associations between file extensions and MIME types: typically, on a Linux
operating system, they are /etc/mime.types, /etc/httpd/conf/srm.conf, and .htaccess in the
same directory as the files which are served. The file /etc/mime.types contains the
official MIME types and should not be modified (it may be overwritten when you
upgrade Apache). The file /etc/httpd/conf/srm.conf contains configuration information for
your site. If you have the permission to modify it, it is the central location
where you should add new MIME types. Look for a line such as
# Format: AddType type/subtype ext1
and add the following line after it (if you do not find this comment, nor any
AddType directive, you can add the line wherever you want):
AddType application/x-sysquake .sq
If you do not have access to this file (for example if your site is hosted
by an internet provider which just allows you to upload the files to be served),
you should add a file named .htaccess (do not forget the initial dot) in the
same directory(ies) as the SQ files. Its content should be
AddType application/x-sysquake .sq
You can have other custom MIME types in the same file, or other configuration
on a per-directory basis, for example to add password protection. Note that the
main configuration file may disable .htaccess. Please read
Apache documentation for more information.
|