University of Delaware

Defining File Types

In order for a browser to properly present your material, you may have to explicitly define the file type in a .htaccess file. If the file is presented differently than you expect in your browser, it might be because the web server doesn't recognize the particular file type.

Note: Currently, it is possible to use .htaccess files only on the central (www.udel.edu) web server. The directions below will not work on the copland (udel.edu) web server.

  1. Log in to your UDelNet account.
  2. At the Copland percent sign prompt, type the following command, replacing directory_name with the name of your directory on the central Web server. Then press ENTER:

    cd /www/htdocs/directory_name

  3. Type the following commands, substituting your file type for file_MIME_type and the suffix (or extension) with which you've named your file for suffix. Press ENTER after each command.

    Note: If you already have a .htaccess file, its contents will be displayed after you type "pico .htaccess." In that case, you will simply be adding the "AddType" line(s) to your .htaccess file, starting on a blank line after the last line of the file.

    pico .htaccess
    AddType file_MIME_type   suffix

    Example of a .htaccess file that defines file types for MSWord documents and Excel worksheets:

    AddType application/msword   .doc
    AddType application/vnd.ms-excel   .xls 

    Example of a .htaccess file that defines the file type for a file you would like the reader to be able to download (substitue your file's extension or suffix for .suffix):

    AddType application/octet-stream    .suffix

  4. Press Ctrl-X to save your .htaccess file and exit the pico editor.
  5. Give your .htaccess file the proper permissions. To do this, type the command below and press ENTER:

    chmod 604 .htaccess

    Now that you have completed these steps, all files in this directory that are named according to the rules you specified in the .htaccess file will be presented with the correct identification to your browser. If the material is still not presented correctly, the browser's preferences for applications will need to be configured.


     


    IT Help Center
    Questions or Comments
    University of Delaware Home Page
    Last updated: April 18, 2005
    Copyright © 2003-2005 University of Delaware