11
Mobile Redirection Script Manual P: 1300 661 133 dealersolutions.com.au Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

Mobile Redirection Script Manual

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Page 2: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

In order to continue, please select one of the following options:

1. My website supports PHP

2. My website does not support PHP

Page 3: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

Instructions for PHP websites

Directions for including the script:

1. Create a new folder named mobile_script in the

root directory.

2. Download the file MobileScript.php by clicking

here.

3. Unzip the file and copy it into the directory created

previously.

Fig. 1

Page 4: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

4. Add the PHP code below to the header page, or on the top of the home page. Include the code right up the top, before any other code is output. Change the $domain variable accordingly to suit the domain of your website URL. See Fig 2.

<?php $script_path = ‘mobile_script/MobileScript.php’; if (file_exists($script_path)) { $currentScript = substr($_SERVER[‘SCRIPT_NAME’], strripos($_SERVER[‘SCRIPT_NAME’],

‘/’)+1); $domain = ‘domain.com.au’; if($currentScript == ‘index.php’ && file_exists($script_path)){ require_once($script_path); $normalsite = $domain; $mobilesite = ‘mobile.’ . $domain; $script = new MobileScript($normalsite, $mobilesite); $script->currentHost = $domain; $script->detect(); } } ?>

Page 5: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

Fig. 2

In order for the script to function:- It assumes that the home page is index.php. If it is not, change the if statement

accordingly.- It assumes that the website files, including the home page, are located in the root

directory. Otherwise, the variable $currentScript will need to be changed accordingly.

Page 6: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

5. If the site has been developed in Wordpress, you will need to add <?php ob_start(); ?>

immediately below the mobile script code snippet.

6. Adjust the following line, to reference the pages that will be redirected. For example, if the

home page is not index.php, then it will need to be renamed to the name of the file.

if($currentScript == ‘index.php’ && file_exists($script_path)){

Website and hosting arrangements often differ in setup. If the mobile script does not

function as required for you, Dealer Solutions can assist. Any further installation

support can be offered at our standard hourly rate of $175 per hour

Page 7: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

Instructions for non PHP websites

1. Create a new folder named scripts in the root

directory.

2. Download the redirection JS files clicking here.

3. Unzip the file and copy the JS files into the

directory created previously.

Fig. 1

Page 8: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

4. Open the file mobile_redirect_cookie.js, search for the following lines within the file

and modify them as required:

var desktopredirect = ‘ ’; // this is the URL of the desktop websitevar mobileredirect = ‘ ’; // this is the URL of the mobile sitevar cookiedomain = ‘.domain.com.au’

Fig. 2

Page 9: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

4. Add the following lines in the <head> section of the website.<script type=”text/javascript” src=”scripts/mobile_redirect.js”></script><script type=”text/javascript” src=”scripts/mobile_redirect_cookie.js”></script>

5. Add to the head of the pages where you want the mobile redirection to occur.window.onload = MobileRedirect();

Fig. 3

Page 10: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

6. Add a link on your desktop website to the mobile website, by linking to:

Fig. 4

Page 11: Mobile Redirection Script Manual - Dealer Solutions · P: 1300 661 133 dealersolutions.com.au Dealer Solutions ty td A 5 15 Mobile Redirection Script Manual 5. If the site has been

P: 1300 661 133 dealersolutions.com.au

Dealer Solutions Pty Ltd - ACN 056 135 490

Mobile Redirection Script Manual

Note that by adding ?wv=mobile to the URL of your website, it will set a cookie on your computer to stay on the mobile site regardless of the device you are using. For example, if you browse to on your desktop machine, it will go back to the mobile site even if you’re not using a mobile. This can be reset by clearing the cookies on the domain.

If you browse to a URL with then it will set a cookie to remain on the desktop website even if using a mobile device.

Website and hosting arrangements often differ in setup. If the mobile script does not

function as required for you, Dealer Solutions can assist. Any further installation

support can be offered at our standard hourly rate of $175 per hour