International Website

Device Redirection: How to do With Siteonmobi

If you have a desktop site with little or no mobile capabilities, we recommend redirecting to a companion Siteonmobi site so that your site can be viewed at its best, and fastest, across all devices. If you are using Siteonmobi as your desktop site as well as mobile site, then redirection does not apply to you.

Using redirection can offer a way to effectively segment your traffic so that users get the best experience when accessing a website, no matter what their device or context. With Siteonmobi, we provide code that you add to your desktop website that will detect when someone is visiting your site from a mobile device and will automatically redirect them seamlessly to your mobile website. There is no need to advertise two different URL’s.

How Do I Generate The Code?

The redirection code can be generated from the ‘Redirection Code Generator’ feature in the ‘Tools’ area within the Siteonmobi Web Manager. You can also do this by selecting the ‘Finish’ button in the Web Manager. You can generate the redirection code for any of the following languages or platforms (see below for more information):

  • JavaScript
  • PHP
  • JSP
  • ASP
  • WordPress
  • Drupal 6 & 7
  • Htaccess
  • Joomla 2.5 & 3.2

You should decide whether you want people who visit on tablet devices to see your desktop site or your Siteonmobi site [select the check-box if you want them to see the Siteonmobi site].

 

redirection-js

4 Simple Steps to Create and Add Redirection Code

Once you are in the Redirection Code Generator section of the Tools area of the Siteonmobi Web Manager:

  1. Select your desktop site language or CMS Platform
  2. Decide whether you would like tablet users to see a desktop site or a Siteonmobi site [select the check-box if you want them to see the Siteonmobi site]
  3. Copy the code snippet or download the file that is generated [The mobile domain of your site has already been inserted into the code generated]
  4. Add the code to the relevant part of your desktop site

The following explains how to add each type of code to your site.

JavaScript

JavaScript is the simplest redirection code method. Note: Not all devices support JavaScript. You will need to use server-side redirection code if you want to redirect traffic from all devices to your Siteonmobi site.

Ø  Decide whether you want people who visit on tablet devices to see your desktop site or your siteonmobi site [select the check-box if you want them to see the siteonmobi site]

Ø  The mobile domain of your site will have already been inserted into the generated code [see sample snippet below with mobile domain highlighted]

Sample of JavaScript redirection code:

<link rel="alternate" media="only screen and (max-width: 640px)" href="http://lherssens.examplesite.siteonmobi"/>

<script type="text/javascript" src="http://detect.deviceatlas.com/redirect.js?m=http://lherssens.examplesite.siteonmobi"></script>

  1. Copy and paste the JavaScript code directly into the HTML code of your desktop site between the <head> and </head> Remember you need to insert the code on each page of your site, not just the home page
  2. Finally save your changes and upload your desktop site pages to where your site is hosted

PHP

Ø  Decide whether you want people who visit on tablet devices to see your desktop site or your siteonmobi site [select the check-box if you want them to see the siteonmobi site]

Ø  The mobile domain of your site will have already been inserted into the generated code

Ø  Copy and paste the PHP code directly into the beginning of the PHP file of your desktop site you wish to redirect. Depending on how your site is built you can either insert the code on each page of your site or just the home page.

Ø  If your site has a header that appears on every page of the site that is built in as an include file, then the redirection code should be added to the header.php file and it will appear across the whole site.

Ø  Finally save your changes and upload your desktop site pages to where your site is hosted

JSP

Ø  Decide whether you want people who visit on tablet devices to see your desktop site or your siteonmobi site [select the check-box if you want them to see the siteonmobi site]

Ø  The mobile domain of your site will have already been inserted into the generated code

Ø  Copy and paste the JSP code directly into the beginning of the JSP file of your desktop site you wish to redirect. Depending on how your site is built you can either insert the code on each page of your site or just the home page. If your site has a header that appears on every page of the site and is built in as an include file, then the redirection code should be added to the header.jsp file and it will appear across the whole site.

Ø  Finally save your changes and upload your desktop site pages to where your site is hosted

ASP.NET (C#)

Ø  Decide whether you want people who visit on tablet devices to see your desktop site or your siteonmobi site [select the check-box if you want them to see the siteonmobi site]

Ø  The mobile domain of your site will have already been inserted into the generated code

Ø  Copy and paste the ASP.NET (C#) code directly into the beginning of the ASP.NET (C#) file of your desktop site you wish to redirect. Depending on how your site is built you can either insert the code on each page of your site or just the home page. If your site has a header that appears on every page of the site and is built in as an include file, then the redirection code should be added to the header. ASP.NET (C#) file and it will appear across the whole site

Ø  Finally save your changes and upload your desktop site pages to where your site is hosted

Htaccess

Ø  Decide whether you want people who visit on tablet devices to see your desktop site or your siteonmobi site [select the check-box if you want them to see the siteonmobi site]

Ø  The mobile domain of your site will have already been inserted into the generated code

Ø  Copy the Htaccess file into any folder on your desktop site for which you want mobile redirection to occur Redirection will then be set up for all sub-folders

Ø  Upload the file into the folder where your site is hosted

Drupal 6

Ø  Decide whether you want people who visit on tablet devices to see your desktop site or your siteonmobi site [select the check-box if you want them to see the siteonmobi site]

Ø  The mobile domain of your site will have already been inserted into the generated code

Ø  Extract the archive in your modules directory (usually path/to/drupal/sites/all/modules)

Ø  Log into your site as admin user and navigate to the modules administration page

Ø  Check the ‘Enabled’ check-box next to the ‘Mobile Redirection’ module

Ø  Click the ‘Save configuration’ button at the bottom of the page

WordPress

Ø  Decide whether you want people who visit on tablet devices to see your desktop site or your siteonmobi site [select the check-box if you want them to see the siteonmobi site]

Ø  The mobile domain of your site will have already been inserted into the generated code

Ø  Extract the archive in your modules directory (usually path/to/WordPress/wp-content/plugin)

Ø  Log into your site as admin user and navigate to the plugins administration page

Ø  Locate the ‘Mobile Redirection’ plugin and click the ‘Activate’ link

Joomal 2.5 & 3.2

 

Ø  Decide whether you want people who visit on tablet devices to see your desktop site or your siteonmobi site [select the check-box if you want them to see the siteonmobi site]

Ø  The mobile domain of your site will have already been inserted into the generated code

Ø  Download the .zip package

Ø  Log into your Joomla site and navigate to Extensions – Install

Ø  Upload your .zip file and Install the plugin