?
Solved

Mobile redirect for deep links

Posted on 2012-09-11
1
Medium Priority
?
693 Views
Last Modified: 2013-11-19
Hi,
I need some information regarding mobile redirection.
My site currently has some code in place to redirect mobile users that visit my home page to the mobile version of our site. That's working fine.

What I want to do now is redirect users users to our mobile version if they visit a deep link.
So for example, if a user comes on their iPad to:
www.mysite.com?productid=44

What is the structure of how I would redirect them to our mobile site?
Say our mobile site is  mobile.mysite.com

Any examples and outside links would be very helpful.

Thanks
Nacht
0
Comment
Question by:nachtmsk
1 Comment
 
LVL 16

Accepted Solution

by:
grahamnonweiler earned 2000 total points
ID: 38388335
Place the following rewrite rules at the top (must be before any other rewrites/redirects) of your .htaccess file.

RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "kindle|symbian|nokia|mobile|windows ce|epoc" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "blackberry|ipod|ericsson,|panasonic|philips|iemobile|sie-"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android"[NC]
RewriteCond %{HTTP_USER_AGENT} !ipad [NC]
RewriteRule ^/?(.*)$ http://mobile.yourdomain.com/$1 [L,NC]

Open in new window

This rewrite any link, including the query string, to your mobile site.

Depending on your server you may have to escape the last line:
RewriteRule ^/?(\.*)$ http://mobile.yourdomain.com/$1 [L,NC]

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question