Mobile redirect for deep links

Posted on 2012-09-11
Last Modified: 2013-11-19
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:

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

Any examples and outside links would be very helpful.

Question by:nachtmsk
    1 Comment
    LVL 16

    Accepted Solution

    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 ^/?(.*)$$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 ^/?(\.*)$$1 [L,NC]

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    The viewer will learn how to dynamically set the form action using jQuery.
    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…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now