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 |
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.
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.
To add the MIME types to a Microsoft IIS server, you need to do the following:
For other servers, see the server documentation.
You can find all the MIME Media Types on the IANA site.