Webpage Detect Redirect iOS & Android

5 posts Page 1 of 1
Contributors
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

Earlier yesterday I started working on making the iOS section of Alternative App's website.

So what I have is when you go to the site on say your iPhone, iPad, or iPod Touch it'll redirect to the iOS section of the webpage.

If you want to do this as well you can put the code below into your head tags.
Code: Select all
<?php
// Redirect iOS visitors
if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
   strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') ||
   strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
      header("Location: http://yourwebsite.com/ios");
}

// Redirect Android visitors
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
      header("Location: http://yourwebsite.com/android");
}
?>
Filip
Coding Guru
Coding Guru
Posts: 833
Joined: Wed Jan 05, 2011 3:59 pm

Nice tut mikethedj4 cooll;

I have never seen something like this on here..
rep+
CodenStuff wrote:
Nope, it's just your sick and dirty mind. You sick twisted warped little pervo :D
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

Thanks! Glad you enjoyed it!
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1891
Joined: Wed Dec 16, 2009 9:56 pm

I was actually wondering how this was done, thanks alot Mike!
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

You're welcome! Glad this became a help for you bro :)
5 posts Page 1 of 1
Return to “Help & Support”