[HELP]Mobile Redirect on homepage ONLY to a mobile Homepage
-
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!
- The topic ‘[HELP]Mobile Redirect on homepage ONLY to a mobile Homepage’ is closed to new replies.