slick Posted February 14, 2006 Posted February 14, 2006 Hi. I wanted to know if this could be done. I want to put on some .wml pages on my site, but the thing is, I want those pages to go to an html page if it is accessed by a regular computer's internet browser. Is it possible to do this? If it isn't possible, is there anyway I can put some code in the .wml files that will only render in HTML browsers. Right now as it is with my .xml files, when I point my browser to them, they are just downloaded as a file and I don't want that to happen. All help will be appreciated. Thanks. Quote
TCH-Bruce Posted February 15, 2006 Posted February 15, 2006 You can do this with a PHP redirection script. ><? $wmlredirect = "http://www.******/wml/index.php";// Your WAP Site $htmlredirect = "http://www.******/html/index.php";// Your HTML Site // Get browser ID $browser=substr(trim($HTTP_USER_AGENT),0,4); // Identify Web Browsers if($browser=="Mozi") // Mozilla, Internet Explorer 6 & Opera 7 { $br = "HTML"; // Identify the above as Web Browsers } else { $br = "WML"; // Identify balance as Wap Devices/Emulators } if($br == "HTML") { header("Location: ".$htmlredirect); exit; } else { header("Location: ".$wmlredirect); exit; } ?> Quote
TCH-Bruce Posted February 15, 2006 Posted February 15, 2006 Or by using rewrite rules in the .htaccess file >#browser redirects For PDA Based Browsers RewriteCond %{HTTP_USER_AGENT} "Windows CE" [NC,OR] #Windows CE and Pocket PC RewriteCond %{HTTP_USER_AGENT} "NetFront" [NC,OR] #PalmSource WebBrowser 2.0 RewriteCond %{HTTP_USER_AGENT} "Palm OS" [NC,OR] #Eudora Web Browser for Palm RewriteCond %{HTTP_USER_AGENT} "Blazer" [NC,OR] #Handspring Blazer Browser RewriteCond %{HTTP_USER_AGENT} "Elaine" [NC,OR] #RIM Devices RewriteCond %{HTTP_USER_AGENT} "^WAP.*$" [NC,OR] #WAP Browsers RewriteCond %{HTTP_USER_AGENT} "Plucker" [NC,OR] #Plucker Offline download client RewriteCond %{HTTP_USER_AGENT} "AvantGo" [NC] #AvantGo Service RewriteRule ^index\.html http://www.yourdomain.net/index.wml [L,R] Quote
slick Posted February 15, 2006 Author Posted February 15, 2006 Hi Bruce. I tried that bit of code and replaced the necessary url's but it is redirecting my html browser (Firefox) to the WAP site. Is there anything else I can do? Thanks. Quote
TCH-Andy Posted February 15, 2006 Posted February 15, 2006 Hi Slick, Which one of the two methods are you trying? Quote
TCH-Bruce Posted February 16, 2006 Posted February 16, 2006 I'd give the .htaccess one a try. Couldn't hurt. I found them both using Google. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.