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 3614822
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:17:50+00:00 2026-05-18T22:17:50+00:00

If a user is viewing my Website www.myUrl.com with a mobile Browser, I would

  • 0

If a user is viewing my Website http://www.myUrl.com with a mobile Browser, I would like to redirect them to mobile.myUrl.com.
I read this thread Auto detect mobile browser (via user-agent?), which says, that you should detect the user-agent and then redirect the user.

But I havent found a thread, which tells me HOW to redirect to mobile.myUrl.com. Should and can I use Apache for that? Or should I instead do it inside my Webapp?

  • 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-18T22:17:51+00:00Added an answer on May 18, 2026 at 10:17 pm

    JAVASCRIPT

    First, let me point out that most mobile devices have the ability to disable Javascript.

    Now, the most common form of redirection for mobile devices is through Javascript. (Apple’s website uses this method.) When the page begins to load, a script is run to determine the User Agent, a browser-specific (and os-specific) string that details the browser type, device type, and/or operating system. This string is then matched against known mobile devices. For example:

    <script language=javascript>
    <!--
    if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
    {
       location.replace("http://mobile.myurl.com");
    }
    -->
    </script>
    

    This script would redirect any browser with a user agent containing “iPhone” or “iPod” to “mobile.myurl.com”.

    This would need to be checked for a bunch of other devices.

    Check this site for more information:

    http://www.hand-interactive.com/resources/detect-mobile-javascript.htm

    If you are using a PHP-compatible server, see this site:

    http://www.hand-interactive.com/resources/detect-mobile-php.htm

    APACHE

    Simply using the mod_rewrite engine, you can redirect browsers with specific user agent strings, just like the Javascript method above:

    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} iPhone
    RewriteCond %{HTTP_USER_AGENT} iPod
    RewriteRule .* http://mobile.myurl.com/ [R]
    

    This checks for “iPhone” and “iPod” users and redirects them to a mobile version of the site.

    More here:

    http://www.themepremium.com/htaccess-code-http_user_agent-of-multiple-phone-browsers-for-wordpress-blogs/

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

Sidebar

Related Questions

I can deny a specific user DB viewing by doing something like this: DENY
How would I be able to check what language the user is currently viewing
I'm making a website/database solution with database viewing/querying rights for the administrator. I would
I noticed that a website like imgur.com displays ads on each page of the
The entire website requires a user to login before viewing the page. If the
I would like to have a div on my companies website that is filled
Is there a way to prevent a user viewing an file but still use
I have a scene written in Java 3d, where the user's viewing position is
On Windows the user has an option to display/hide file extensions when viewing files.
User Region Points Last_Updated 1 5 0 1-Nov-09 I want this row 2 1

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.