PHP Browser Redirect
Wednesday, 13 June 2012
0
comments
It is an simple example which will take the visitors to one page if they are using Internet Explorer, and to another page if the visitor is using another type of browser.
Now lets decide what is going to happen if:
This is the example php code, it can be modified in many ways to fill your requests.
Now lets decide what is going to happen if:
- If the browser is Microsoft Internet Explorer (MSIE), it will automatically redirect to: www.tutorialize.org/redirect1 ( example )
- If the browser is not Microsoft Internet Explorer (MSIE), it will automatically redirect to: www.tutorialize.org/redirect2( example )
This is the example php code, it can be modified in many ways to fill your requests.
//if its MSIE then if ($name = strstr ($HTTP_USER_AGENT, "MSIE")) { //it will send to www.tutorialize.org/redirect1 Header ("Location: http://www.tutorialize.org/redirect1"); } else { //else will send to www.tutorialize.org/redirect2 Header ("Location: http://www.yahoo.com/"); }