Jump to content

How To Redirect Mobile Users to a custom page @ http://m.mywesite.com


Recommended Posts

I really don't like the home page of default prestashop theme for mobile. so i want to create a custom html page as a home page for mobile & tablet customers, other pages will be same as default.

so i want to redirect the www.mywebsite.com domain visitors of mobile & tablet users to my sub-domain at  m.mywebsite.com.

 

this way i will create a index page at my sub-domain and put the products likes there so that the mobile customers can visit the the main site from there easily.

 

 

http://www.inmotionhosting.com/support/website/redirects/mobile-redirect

http://blog.woorank.com/2014/06/how-to-redirect-mobile-users-on-your-website/

 

i googled a bit and fund some idea about them at these site but not able to apply them.

I did not able to find the <head> in my index page. i am new to php format.

 

PLEASE HELP

 

 

php code-

 

<!--?php <br ?-->   $iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
   $android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
   $berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
   $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
   if ($iphone || $android || $palmpre || $ipod || $berry == true)
   {
      echo "<script>// <![CDATA[
window.location='http://m.site.com'
// ]]></script>";
 }
?>


html code-


<script type="text/javascript">
<!--
if (screen.width <= 800) {
window.location = "http://m.domain.com";
}
//-->
</script>
 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...