Okay then, let’s get to it. We are going to be using the JS-Redirection-Mobile-Site script found at Git Hub here. Now, before you click that link and get yourself all confused, I’m going to break down everything for you. Okay, first things first. Download redirection-mobile.js here. Just highlight the text, copy it, and then create a new text document in a folder in your site called “js” and name it redirection-mobile.js. Good, we are almost done. Now, in the <head> section of the page you are looking to redirect, paste this:
Easy stuff. Now replace “urltoredirectto.com” with, well… The URL you would like to redirect to. Now upload this to your server, and you are good to go!
What this will do is redirect most mobile visitors (but not tablets) to this URL. And it works great, because if they go to that mobile site, and then click a link to come BACK to the page they were just redirected from, it won’t redirect them again, allowing them to view the regular page.
I’ve had many requests for instructions on including a tablet redirect as well, so I’m going to show you how to do that. Setting tablet_redirection to “true” will redirect tablet users as well. If you would like to specify a separate location for tablet users, you can do that by entering a value for “tablet_host”. So the code will now look like:
For a full list of parameters you can use, view the github page I linked to earlier and find the readme there, it has a detailed explanation of everything. I hope this helps someone avoid all the trouble and work I had to go through to figure this out! Thanks for stopping by.