Flash Central's
Flash Tech Resource
Setting MIME for Apache


There are 3 ways to add a MIME setting to an Apache Server.
The first and best way is to add the following to mod_mime.c and recompile:

      AddType application/futuresplash spl
      AddType application/x-shockwave-flash swf

If you are unable to recompile the server you can configure the Server
or even a directory if you don't have root directory permissions.


For Apache, there is a configuration directory which contains several files that are instrumental in determining how your server runs (and even if it will run at all). In a standard Apache installation, these files are stored in a directory called  conf/. The file that we are concerned with is mime.types.

1.  Mime.types  contains a list of all the mime types that are currently set on the server. Adding a new one is quite simple. Simply load the file into your favorite text editor (I like vi, but pico is very easy to use):

2.  cd into your Apache conf/ directory. On my server, this directory is located at /usr/local/etc/httpd/conf/, so I would type:
cd /usr/local/etc/httpd/conf/

3.  Load the file into your text editor. You will see that all the mime.types on the server are listed alphabetically. Page down until you see where you want to insert the mime type for flash.

4.  Add a new line that reads
     application/x-shockwave-flash    swf

5.  Save the file.
With pico, enter CTRL-X, and then answer "yes" to the prompt to overwrite the existing file.
In vi, press escape to return to command mode, and type the following keys in sequence:   :wq  (include the colon, it is important).
This will write the file and quit to the unix prompt.

6.  The file has been updated, so now you have to restart your server to make the changes take effect. Since every running process on Unix has a unique process ID number, you must determine the ID number of the parent Apache process. This number is stored in a file called "httpd.pid", and is usually located in the logs/ directory. If you are still in the conf directory, type
    cd ../logs
and you will now be in the logs directory (logs and conf both have the same parent directory, usually, so this works nicely). If you type   ls -a   in this directory you will see a file called httpd.pid. To restart the server (you have to be logged in as root to do this, normally), type:
   kill -HUP `cat httpd.pid`
which does several things - `cat httpd.pid` returns the contents of the file httpd.pid, which contains a single line - the process id of the server. kill -HUP sends the process a signal that tells it to re-read its configuration files and restart.

Depending on your particular flavor of Unix you may have files located in different places, so consult your sys admin if you aren't sure. The whole process takes maybe 2 or 3 minutes.


Setting MIME for a particular Directory:

You may specify a particular Document Type inside an .htaccess file. You can include a line in this file like this:

AddType application/x-shockwave-flash   swf

You may also place this line inside the directive, similar to the way it was above, if you don't want to use .htaccess.



Thanks to  Jason Nugent  for this information on Apache Servers.



See ALSO

Macromedia Note 4151 on what is needed and why.

Macromedia's Note 4159 with links to MIME set-up for several Server Software programs.

Back to Index