Help In Redirecting Pc & Wap Users

Started on the old forum in August 2008 · view the original in the archive · old links redirect here

12 replies · 1,058 views · started 18 years ago · 1 min read

8 participants
Guest #1

Hi

i use a XHTML wap site.

and i hav a PC version of website separate.

i dont want PC users to use my wap site.

only thro Mobiles the WAP site should be browsed. other user should be redirected to the original PC version website...

how do i do that ?

any correct code available ?

:sad:

wolf77ar Developer · 51 posts #2

You can make one redirection for you script You can made in file caled redirect.php and put this code: CODE<? $browser = explode("",$HTTP_USER_AGENT); if($browser[0]=="Mozilla") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="Net Scape") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="MSIE") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="Opera") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="Safari") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="http://Anonymouse.org") { header ('Location: http://Anonymouse.org'); exit;} ?> After that you can use include function eg: include("redirect.php"); in all your files from script

Because you script is in XHTML you can`t use ($HTTP_ACCEPT),"VND.WAP.WML") to accept only wap browsers and user can enter from some hide browsers For begin is good this code If you use $browser = explode("/ ",$HTTP_USER_AGENT); to show entire browser Modify in redirect.php corectly Also you can use this script to redirect any browser just put another lines like:

if($browser[0]=="browser") { header ('Location: http://www.some_site.com/'); exit;} in redirect.php

echo "<a href="http://wapcomunity.ro">[-Enter Here-]</a>";

GiLL Senior · 356 posts #3

Hi

i use a XHTML wap site.

and i hav a PC version of website separate.

i dont want PC users to use my wap site.

only thro Mobiles the WAP site should be browsed. other user should be redirected to the original PC version website...

how do i do that ?

any correct code available ?

:sad:

use as u need like change pc and mobile php in it as your own and call it index.php

<?
$htmlredirect = "http://site.com/pc.php";
$wmlredirect = "http://site.com/mobile.php";
if(strpos(strtoupper($HTTP_ACCEPT),"VND.WAP.WML") > 0){
header("Location: ".$wmlredirect);}
else{
header("Location: ".$htmlredirect);
exit;}
?>

left wap stuff

Guest #4

thx...

let me try...

Guest #5

You can make one redirection for you script You can made in file caled redirect.php and put this code: CODE

<? $browser = explode("",$HTTP_USER_AGENT); if($browser[0]=="Mozilla") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="Net Scape") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="MSIE") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="Opera") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="Safari") { header ('Location: http://www.google.ro/'); exit;} if($browser[0]=="http://Anonymouse.org") { header ('Location: http://Anonymouse.org'); exit;} ?>

After that you can use include function eg: include("redirect.php"); in all your files from script

Because you script is in XHTML you can`t use ($HTTP_ACCEPT),"VND.WAP.WML") to accept only wap browsers and user can enter from some hide browsers For begin is good this code If you use $browser = explode("/ ",$HTTP_USER_AGENT); to show entire browser Modify in redirect.php corectly Also you can use this script to redirect any browser just put another lines like:

if($browser[0]=="browser") { header ('Location: http://www.some_site.com/'); exit;} in redirect.php

wat problem here ????

Warning: explode() [function.explode]: Empty delimiter in public_html/xxxx/xxxxx/redirect.php on line 2

inet Senior · 264 posts #6

wat problem here ????

do you need a better version of that?

lol i want to share with you my own version..

Services

Are you looking to take your wap or wapsite to a higher level? Do you want to stand out and rise above your competitors?

Below is a list of services I offer:

Wap Design and Customized Coding -The first way to stand out in a crowd is to have a brilliant and unique design for your wap or wapsite.

Rates

General consulting – My current hourly rate is $100 / hour. Custom Wapsite Community - My current rate is $500 / Wap Community Development.

Guest #7

do you need a better version of that?

lol i want to share with you my own version..

Sue.... send me.... 😉

inet Senior · 264 posts #8

Sue.... send me.... ;)

CODE

just edit this whatever you like mobile browsers and place it to your page

<?php /* [facedown_pogi@yahoo.com](mailto:facedown_pogi@yahoo.com) */ //Define your mobile website alternative $site = "mydomain.com/web/page"; //Defines the user browser $agent = $_SERVER['HTTP_USER_AGENT']; /////////////////////////////////////////////////////$agent = explode("",$HTTP_USER_AGENT); use me or not //Check for various mobile browsers and redirect if confirmed if (eregi("mozilla", $agent)) { header( "Location: $site" ) ; } if (eregi("Palm OS", $agent)) { header( "Location: $site" ) ; } if (eregi("Blazer", $agent)) { header( "Location: $site" ) ; } if (eregi("Plucker", $agent)) { header( "Location: $site" ) ; } if (eregi("AvantGo", $agent)) { header( "Location: $site" ) ; } ?>

i advise you to use the wapdesire redirect page in index.php go search that

Services

Are you looking to take your wap or wapsite to a higher level? Do you want to stand out and rise above your competitors?

Below is a list of services I offer:

Wap Design and Customized Coding -The first way to stand out in a crowd is to have a brilliant and unique design for your wap or wapsite.

Rates

General consulting – My current hourly rate is $100 / hour. Custom Wapsite Community - My current rate is $500 / Wap Community Development.

spicysoul Newbie · 5 posts #10

i have a mobile site .also pc ver.i want redirect pc user on pc version...how? any 1 help us by real code...

WhiteWarrior Principal · 1,419 posts #11

and whos got a list of mobile browsers and web browsers?

ori Lead · 512 posts #12
function mobile(){
if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce'))return false;
if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp',$_SERVER['HTTP_USER_AGENT']))return true;
if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml'))return true;
if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels']))return true;
$a=array('acs-','alav','alca','amoi','audi','aste','avan','benq','bird','blac','blaz','brew','cell','cldc','cmd-','dang','doco',
'eric','hipt','inno','ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-','maui','maxo','midp','mits','mmef',
'mobi','mot-','moto','mwbp','nec-','newt','noki','opwv','palm','pana','pant','pdxg','phil','play','pluc','port','prox','qtek',
'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar','sie-','siem','smal','smar','sony','sph-','symb','t-mo',
'teli','tim-','tosh','tsm-','upg1','upsi','vk-v','voda','w3c ','wap-','wapa','wapi','wapp','wapr','webc','winw','winw','xda','xda-');
if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)]))return true;
}

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