Page 1 of 1
How to redirect opera users?
Posted: Thu Dec 08, 2011 5:32 pm
by hhs
hi all
How to redirect opera users?
i used this :
Code: Select all
if(preg_match('/MSIE/i',$u_agent) || preg_match('/Opera/i',$u_agent))
{
header("Location: http://www.example/getfirefox.php");
}
but it doesent work
Re: How to redirect opera users?
Posted: Thu Dec 08, 2011 8:18 pm
by twinedev
After any header("Location: .... ); you need an exit; so that the script stops running, otherwise they will still get all the output.
Re: How to redirect opera users?
Posted: Fri Dec 09, 2011 7:13 am
by hhs
helppppp meeee
it doesent work
i want redirect opera users to another page
Re: How to redirect opera users?
Posted: Fri Dec 09, 2011 8:56 am
by twinedev
what is in $u_agent ? (not what you think it should be, what is the ACTUAL value)
Re: How to redirect opera users?
Posted: Fri Dec 09, 2011 2:56 pm
by hhs
Re: How to redirect opera users?
Posted: Fri Dec 09, 2011 3:05 pm
by Celauran
You haven't answered twinedev's question. Also, I recommend reading the comments as to why doing this is a bad idea.
Re: How to redirect opera users?
Posted: Sat Dec 10, 2011 2:58 pm
by hhs
hi
i found it
thank you ...
Code: Select all
<?php
$opera = stripos($_SERVER['HTTP_USER_AGENT'],"opera");
if ($opera=="true")
{
header( 'Location: http://www.toprank.ir/opera.php' ) ;
}
?>