What's with the HTTP server MIME types?

When you access a “web page” using a PC based browser, the “web server” tells your PC browser what kind of document it should expect. This is done by using something called MIME-types. The common MIME type for a plain HTML document is “text/html”. However, for a WAP browser, which cannot read HTML, the MIME type has to be different.

The MIME types for serving WML contents are:

Document type MIME type Typical extension
Plain WML documents text/vnd.wap.wml .wml
Wireless Bitmap Images image/vnd.wap.wbmp .wbmp
Compiled WML documents application/vnd.wap.wmlc .wmlc
WMLScripts text/vnd.wap.wmlscript .wmls
Compiled WML Scripts application/vnd.wap.wmlscriptc .wmlsc
XHTML Basic application/xhtml+xml .xhtml
XHTML-MP application/vnd.wap.xhtml+xml .xhtml

Apache configuration

HTTPd configuration

Depending on your linux distribution or Apache package you might need to edit srm.conf or httpd.conf or another file.
Locate the AddType section, and add the following section to the file:

# MIME Types for WAP
AddType text/vnd.wap.wml .wml
AddType image/vnd.wap.wbmp .wbmp
AddType application/vnd.wap.wmlc .wmlc
AddType text/vnd.wap.wmlscript .wmls
AddType application/vnd.wap.wmlscriptc .wmlsc
AddType application/vnd.wap.xhtml+xml .xhtml

Note that we have only added the XHTML-MP MIME type. XHTML Basic and MP often share the same extension, if you wanted to add both you should use different extensions. The procedure remains the same.

Save the file and restart the Apache HTTPd.

htaccess configuration

If you do not have control over your Apache server, for instance if you are with an ISP, it is also possible to add a file called .htaccess to each directory where you have placed WML files. When the server reads files from this directory, it will serve them according to the rules in the .htaccess file.

A typical .htaccess file will look something like this:

DirectoryIndex  index.wml
addtype text/vnd.wap.wml wml
addtype application/vnd.wap.wmlc wmlc
addtype text/vnd.wap.wmlscript wmls
addtype application/vnd.wap.wmlscriptc wmlsc
addtype image/vnd.wap.wbmp wbmp
AddType application/vnd.wap.xhtml+xml .xhtml

Note the first line which tells the server that the index file for this directory is called index.wml. Also note that the server must be configured to read these files. In some cases the server is configured to ignore these files for security reasons. Check with your ISP.

Note that we have only added the XHTML-MP MIME type. XHTML Basic and MP often share the same extension, if you wanted to add both you should use different extensions. The procedure remains the same.

Microsoft IIS

To add the MIME types to a Microsoft IIS server, you need to do the following:

  • On the server console, open the Management console
  • From here you can define the MIME types to either be valid for the entire server or to be valid for separate directories.
  • To add a MIME type to a directory: Right click on the directory in which you want to add the MIME type.
  • Select the HTTP headers tag.
  • Click the File types button at the lower right.
  • Click New type and supply the extension and the content type as listed above.
  • To add a mime type to an entire server; Right click on the server.
  • Click the File types button and follow the instructions above.
  • Click New type and supply the extension and the content type as listed above.

For other servers, see the server documentation.

You can find all the MIME Media Types on the IANA site.

 
what_s_with_the_http_server_mime_types.txt · Last modified: 2007/01/06 16:14 by atrasatti
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
vendita computer arredo giardino poltrona massaggi