OYEWAP.COM

 
  Why does a normal HTTP 302 redirect not work with WAP?

The truth is that it does. The crucial detail is the server side script language, or rather the interaction between the server side script language and the webserver.

The so called 302 Found HTTP response basically means that the webserver tells the user agent that the resource may be found elsewhere, temporarily. The 302 respons may include a human readable message, and if this is the case it requires the Content-type : to be set. All webservers I have tested so far add a Content-type : to the response even if there is no content. By default the Content-type : is in normal circumstances text/html. Some gateways might not like this, although it's unclear if this is the actual problem some people are experiencing.

Thanks to Al Sutton, John McAleely and Patrice Slupowski, the following code examples have been tested and found to work on Apache and Microsoft Internet Information Server. If you use another webserver or another script language, you should be able to convert these rather simple script snippets. And the keywork is simple. No need to tell the webserver to generate a full HTTP header unless you need to. Most webservers will complement the header so that the user agent understands it. This is just to override what's absolutely required as a minimum.

 
<?
  header("Location: http://http://allnetdevices.com/faq/clientinfo.html");
  header("Content-type: text/vnd.wap.wml";
?>

Perl code example which can be tested at http://wap.colorline.no/cgi-bin/302test.pl:


print "Location: http://http://allnetdevices.com/faq/clientinfo.html\n";
print "Content-type: text/vnd.wap.wml\n";

ASP code example which can be tested at http://www.colorline.no/302test.asp (note different URL):

 
<%
  Response.Redirect = "http://http://allnetdevices.com/faq/clientinfo.html";
  Response.ContentType = "text/vnd.wap.wml";
  Response.Flush
  Response.End
%>