Redirect Script...

Started on the old forum in June 2007 · view the original in the archive · old links redirect here

11 replies · 980 views · started 19 years ago · 1 min read

5 participants
WhiteWarrior Principal · 1,419 posts #1

i need a redirect script where just say im on pc or on my phone i goto http://blahblah.com it will redirect to web site if im on pc and to wap if in on my mobile?.. anyone got this? thanks

A-Y-S Junior · 13 posts #4

i think this very good

CODE<?php /** *

*/

/** */

//EDIT BELOW

//your web url $WEB_URL = 'http://wapforum.uk.to/';

//your wap 1.0 url $WAP_URL = 'http://wapforum.uk.to/wap/';

//url for wap 2.0 and similar html and wml compatible browsers $BOTH_URL = 'http://wapforum.uk.to/archive/';

//a url to redirect strange or unrecognized browsers, its very unlikely this will be needed $MMM_URL = 'http://wapforum.uk.to/';

//DO NOT EDIT BELOW THIS LINE UNLESS YOUR EXPERIENCED IN PHP

//if browser does NOT accept wml then html variable is true if ((eregi ("text/vnd.wap.wml", $HTTP_ACCEPT)) != true) { $HTML = 'TRUE'; }

//lets see if wml is true also or if its a pure web browser if ((eregi ("text/html", $HTTP_ACCEPT)) != true) { $WML = 'TRUE'; }

//if wml AND html are true it must be wap 2.0 phone and we should direct to html lo-fi (or give a choice) if ($HTML='TRUE' AND $WML='TRUE' AND $S60='FALSE') { //both wml and html set true $BOTH = 'TRUE'; }

//if wml and html true if ($BOTH='TRUE') { //redirect to both url //exit header("Location: $BOTH_URL"); exit; }else {

//if wml is true if ($WML='TRUE') { //redirect to wap url //exit header("Location: $WAP_URL"); exit; }else {

//if web is true if ($WEB='TRUE') { //redirect to web url //exit header("Location: $WEB_URL"); exit; }else {

//if for some strange reason its not any of the above let it carry on to the web site.. Or is it a bot? Pmpl //redirect to mmm //exit header("Location: $MMM_URL"); exit; }}}

// END OF REDIRECTION - SCRIPT BY DEVIANCEX // HTTP://WAPFORUM.UK.TO - THE BEST WAPFORUM //////////////////////////////// //© 2001-2006 devianceX //////////////////////////////// ?>

blackhowk Senior · 411 posts #5

i need a redirect script where just say im on pc or on my phone i goto http://blahblah.com it will redirect to web site if im on pc and to wap if in on my mobile?.. anyone got this? thanks

m8 you are advanced member here and you dont know the posts, parts and scripts on this forum... here is example:

  1. <blockquote><?php
  2. if ((eregi ("htm", $_SERVER['HTTP_ACCEPT'])) == true){ ?>
  3. <!DOCTYPE html
  4. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  5. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html>
  7. <head>
  8. <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  9. <meta http-equiv="refresh" content="1;url=xhtml.php" />
  10. <title>ngeo chat</title>
  11. <link rel="stylesheet" type="text/css" href="style_logo/style.css" />
  12. </head>
  13. <body>
  14. Please wait... Click below if yo do not wish to wait, or your Mobile Phone don 't make the transfer
  15. enter
  16. </body>
  17. </html>
  18. <?php
  19. exit();
  20. }
  21. else
  22. {
  23. header("Content-type: text/vnd.wap.wml");
  24. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  25. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  26. header("Cache-Control: no-cache, must-revalidate");
  27. header("Pragma: no-cache");
  28. header("Provided-by:ngeo@ngeo.ro");
  29. echo "<?xml version=\"1.0\"?>
  30. <!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
  31. ." "http://www.wapforum.org/DTD/wml_1.1.xml">\n";
  32. ?>
  33. <wml>
  34. <card id="ngeo" title="ngeo chat" ontimer="wml.php">
  35. <timer value="1"/>
  36. Please wait... Click below if yo do not wish to wait, or your Mobile Phone don 't make the transfer
  37. enter
  38. </card>
  39. </wml>
  40. <?php
  41. exit();
  42. }
  43. ?></blockquote>
WhiteWarrior Principal · 1,419 posts #8

yes i know its not hard but when i posted this i had a bad headache and didnt want to code it, sorry

Guest #11
<?php
if ((eregi ("text/vnd.wap.wml", $HTTP_ACCEPT)) != true)
        {
        header("Location: http://yoursite.com");
        exit;
        }
else
        {
        header("Location: http://yoursite.com");
        exit;
        }
?>

easy External image (may be gone)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close