Place an 'index.html' and 'index.wml' file in the document root directory, and you will then be able to use the same URL (http://yoursite) for both HTML and WML (WAP) clients.DirectoryIndex /cgi-bin/redir.pl
Update:#! /usr/bin/perl print"Location: index.".(($ENV{HTTP_ACCEPT}=~/html/g)[0]||'wml')."\n\n +";
Amended code is shown below:
Update (12-Oct-2001) How this works:#! /usr/bin/perl $ENV{HTTP_ACCEPT}=~/vnd\.wap\.(wml)/; open FILE,"$ENV{DOCUMENT_ROOT}$ENV{REQUEST_URI}index.${\($1||'html')}" + or die($!); print "Content-type: text/${\($&||'html')}\n\n"; print while (<FILE>);
A notable exception to this is Opera, which sends the WML content type if the URL is in the form http://wap.site.tld, but not for URLs like http://www.site.tld or http://site.tld, so if you are using this code then make sure your host name does not start http://wap. or Opera users will not be able to view the HTML version of your site.
I have used the above method at http://jonallen.info, and it has been tested on the following platforms:
WAP phones:
|
|---|