• I have a site where cannot live without this flash slider plugin that is only found on the homepage. I figured that I would just create another page that looks the same as the homepage, but replace the flash slider with a JS slider. Then I would just redirect mobile users from the homepage to the mobile homepage.

    I want mobile users who goes to https://example.com to go to https://example.com/mobilehome instead. However if a mobile user goes to https://example.com/about I don’t want them going to https://example.com/mobilehome. I only need a mobile redirect on the homepage only.

    To my surprise I couln’t find a plugin that only allowed a mobile redirect from one page to another. I know the cheesy workaround would be have two different WP installs that emmulate eachother and just use a plugin that redirects users to that other site, but that means I have to copy every post I do.

    I have attempted a couple of ways of doing this.

    FAIL attempt at doing this with PHP

    <?php
    if(is_home()) {
    include('mobile_device_detect.php');
    mobile_device_detect(true,true,true,'https://example.com/mobilehome/',true,true,true,'https://example.com/mobilehome/',false);
    }
    ?>

    I am using this script, mobile_device_detect.php from https://detectmobilebrowsers.mobi/

    FAIL attempt at doing it in httaccess

    # BEGIN Mobile redirect for the video
    <IfModule mod_rewrite.c>
        RewriteEngine On
        # RewriteRule ^mobile/ - [L]
        # redirect /example.com/index.html to /mobilehome/index.html for mobile browsers
        RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
        RewriteRule ^\index.php$ /mobilehome/index.php [L,R=302]
    </IfModule>
    # END Mobile redirect

    If anyone knows a good way of doing this mobile direction, please help!!!

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • i am also desperate for a solution to this!

    Hello,
    I was able to get this to work using the https://detectmobilebrowsers.mobi/ ‘s code and a little variation of what you tried before.
    I uploaded the php file from the detectmobilebrowers.mobi site to my child theme’s folder and added the following code to the functions.php file in my child theme.

    require_once('mobile_device_detect.php');
    mobile_device_detect(true,true,true,true,true,true,true,'https://example.com/mobilehome',false);

    Worked like a charm.

    Hope this helps.

    Cheers.

    Pardon the bump on an old post.

    Mat Lipe– I tried using your solution, but it seems to redirect all my pages from mobile devices to the selected page. Do you know how to set only one redirect (for the homepage)?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[HELP]Mobile Redirect on homepage ONLY to a mobile Homepage’ is closed to new replies.