Alternate and Other Automatic Redirection Scripts

Overview

On this page, you will find many of different codes to redirect your site. By default, the JavaScript redirect code is provided to embed directly into your original website's HTML, but also use server side options to set up the redirect.

Client Side Redirect using JavaScript

This method is the easiest to install. Simply paste the JavaScript code below into the head tag of your HTML page, and replace in the code the " http://m.example.com " with your mobile website domain (including http://).




Note: some mobile devices like old blackberry models don't support JavaScript, if you would like to support those devices as well, you will need to use server-side redirection

Redirect using server side snippet

The server-side method might be more complex to implement but will ensure that mobile devices that do not support JavaScript are supported as well. Below are code examples for PHP, ASP and JSP. Please replace the place holder " http://m.example.com" in the code with your mobile website domain (including http://).

PHP

Paste the code below in the very beginning of your index.php file. Be sure to edit the m.example.com with your own mobile URL