Jump to content

superDR01D

New Members
  • Posts

    2
  • Joined

  • Last visited

superDR01D's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Awesome thank you so much!!!! Ok so... 1) Put that php script in a file called inde.php and upload it to my root directory. 2) Upload mobile_detect.php to my root directory. My only question is what triggers those 2 PHP files to be served up to people who visit my site? Do I have to call them somehow in my index.htm file? Or maybe set something up on the server so that inde.php is called as soon as someone visits my site? BTW my site structure is very basic. index.htm and the rest of my htm files are in the root directory. I created a m (mobile) sub directory for my mobile website. m.mywebsite.com Thanks a ton!!!
  2. I need a tiny shove in the right direction on how to implement this prewritten mobile detection script. It comes up #1 on Google but it has no instructions. Could anybody help me with this? http://mobiledetect.net/ Q1) I believe this code needs to be placed at the top of every HTML file on my site. But where in the HTML file do I place it? When I put it at the very top of my index.htm it doesn't run. The code prints out like plain text at the top of the webpage. <?php require_once 'Mobile_Detect.php'; $detect = new Mobile_Detect; // change the mobile url here (between the quotes) $mobileurl = "http://m.mywebsite.com"; $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); if( $detect->isMobile()){ header("Location: " . $mobileurl,true, 301); /* Redirect browser */ /* Make sure that code below does not get executed when we redirect. */ exit; } ?> Q2) Mobile_Detect.php I believe I need to upload this file to my root directory. That's easy enough but does it need special permissions or something else? Right now permissions are set to 0644 on this file. Q3) Do I need to update my .htaccess file which is blank? I'm hosting with GoDaddy so I believe it's on an Apache server. Q4) Is there any other obvious thing that I'm missing? Thanks a ton in advance!!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.