Mobile Redirecting, How to?

by ErnieB
1 replies
I have seen plugins for wordpress that will allow your visitors to be redirected to a different theme if they are browsing form a mobile phone. What I want to try and do is redirect them from my wordpress site to a regular (html? ) site if they are mobile browsing. Is that possible? ( same domain name )
#mobile #redirecting
  • Profile picture of the author Evan-M
    Originally Posted by ErnieB View Post

    I have seen plugins for wordpress that will allow your visitors to be redirected to a different theme if they are browsing form a mobile phone. What I want to try and do is redirect them from my wordpress site to a regular (html? ) site if they are mobile browsing. Is that possible? ( same domain name )


    you can use http rewrite rules, or you could use javascript, but the latter might not be as feasible because if they have js disabled on the pda, it won't catch. http rewrite happens on your server based on their user agent, though, so that would be much more reliable...


    ex

    RewriteCond %{HTTP_USER_AGENT} “Windows CE” [NC,OR] #Windows CE and Pocket PC
    RewriteCond %{HTTP_USER_AGENT} “NetFront” [NC,OR] #PalmSource WebBrowser 2.0
    RewriteCond %{HTTP_USER_AGENT} “Palm OS” [NC,OR] #Eudora Web Browser for Palm
    RewriteCond %{HTTP_USER_AGENT} “Blazer” [NC,OR] #Handspring Blazer Browser
    RewriteCond %{HTTP_USER_AGENT} “Elaine” [NC,OR] #RIM Devices
    RewriteCond %{HTTP_USER_AGENT} “^WAP.*$” [NC,OR] #WAP Browsers
    RewriteCond %{HTTP_USER_AGENT} “Plucker” [NC,OR] #Plucker Offline download client
    RewriteCond %{HTTP_USER_AGENT} “AvantGo” [NC] #AvantGo Service
    RewriteRule ^index.php http://www.yourdomain.net/pda.php [L,R]


    another way ( iphone example )

    # Catch iPhone-users first, easiest to discover
    RewriteCond %{HTTP_USER_AGENT} .*Mobile.*Safari
    RewriteRule ^[\./](.*)$ http://beta.mydomain.no/iphone [L]

    # Catch most familiar web browsers and redirect to web version,
    # except Opera Mini and SymbianOS (which identifies itself as Safari)
    RewriteCond %{HTTP_USER_AGENT} ((.*MSIE.*Windows\ NT.*)| \
    (Lynx.*)|(.*Safari.*)|(.*Opera.*)|(.*Firefox.*)|(. *Konqueror.*))
    RewriteCond %{HTTP_USER_AGENT} !(.*Opera\ Mini.*)
    RewriteCond %{HTTP_USER_AGENT} !(.*SymbianOS.*)
    RewriteRule ^[\./](.*)$ http://beta.mydomain.no/web [L]

    # Browsers that match neither block, such as regular screen
    # browsers, could be caught by a final rewrite rule placed here,
    # or we could leave it out and have nothing happen to the
    # requested URL. This is the default.

    RewriteRule ^[\./](.*)$ http://beta.mydomain.no/mobile [L]
    Signature

    Evan-M

    Easily The Worlds Best Wordpress Popup plugin

    Visit Website Design Firm For All Your Wordpress Coding Needs

    {{ DiscussionBoard.errors[3383957].message }}

Trending Topics