Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7635655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:28:52+00:00 2026-05-31T07:28:52+00:00

Is there any way to redirect user to subdomain when he is using iPhone

  • 0

Is there any way to redirect user to subdomain when he is using iPhone and then redirect to a different subdomain when he is using android, this all using php?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:28:54+00:00Added an answer on May 31, 2026 at 7:28 am

    Yes, you can use the $_SERVER global array to detect various information about a request such as the request headers. In particular, you can parse out the User Agent string to determine the browser connecting to your PHP application and redirect based on this information.

    The PHP get_browser function documentation here has a good example:

    <?php
    echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";
    
    $browser = get_browser(null, true);
    print_r($browser);
    ?>
    

    Using the above you might craft your own functions like isAndroid or isIphone to detect the mobile device by the user agent string.

    function isAndroid()
    {
        if(preg_match('/android/i', $browser))
            return true;
        return false;
    }
    
    function isIphone()
    {
        if(preg_match('/iphone/i', $browser))
            return true;
        return false;
    }
    

    For reference, an iPhone user agent string will looks something like:
    Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3

    Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a

    And an Android’s user agent string will look like:
    Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any way to access or set iphone's alarm? Im assuming if this
I m currently looking into android notification. Is there any way to show all
Is there any way to detect session timeout without (user interaction)*, and redirect it
Is there some way to redirect a user that reaches gets the AccessDenied-error on
Is there any way to redirect a page to a specific hash but prevent
Is there any way to change the BackColor of the border of a panel
Is there any way I can run class files (i.e. with main as the
Is there any way to view the reduction steps in haskell, i.e trace the
Is there any way to change the icon of an application after it is
Is there any way to validate the contents of a CEdit box without subclassing?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.