How do I redirect mobile user from my main page?

Discussion in 'HTML & Website Design' started by Onesite, Jun 19, 2010.

  1. #1
    I'm trying to test mobile redirection with .htaccess files ans so far it didn't work.

    As a test try to redirect all mobile user to say m.google.com:


    #iphone ipod detection
    RewriteCond %{HTTP_USER_AGENT} ^.*iphone.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #Ipod detection
    RewriteCond %{HTTP_USER_AGENT} ^.*ipod.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #android detection
    RewriteCond %{HTTP_USER_AGENT} ^.*android.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #opera mini detection
    RewriteCond %{HTTP_USER_AGENT} ^.*opera.mini.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #blackberry detection
    RewriteCond %{HTTP_USER_AGENT} ^.*blackberry.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #palm detection
    RewriteCond %{HTTP_USER_AGENT} ^.*up\.browser|up\.link|mmp|symbian|smartphone|mid p|wap|vodafone|psp|pocket|kindle|mobile|treo.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #nokia detection
    RewriteCond %{HTTP_USER_AGENT} ^.*nokia.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #Samsung detection
    RewriteCond %{HTTP_USER_AGENT} ^.*sgh.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #Sony Ericsson detection
    RewriteCond %{HTTP_USER_AGENT} ^.*sonyericsson.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #Playstation Portable detection
    RewriteCond %{HTTP_USER_AGENT} ^.*psp.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #Motorolla detection
    RewriteCond %{HTTP_USER_AGENT} ^.*mot.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #HTC detection
    RewriteCond %{HTTP_USER_AGENT} ^.*htc.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #LG detection
    RewriteCond %{HTTP_USER_AGENT} ^.*lg.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #iPAQ detection
    RewriteCond %{HTTP_USER_AGENT} ^.*lg.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #Nokia detection
    RewriteCond %{HTTP_USER_AGENT} ^.*nokia.*$ [NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    #mobiles detection
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [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|ericsson,|panasonic|philips|sanyo|shar p|sie-”[NC,OR]
    RewriteCond %{HTTP_USER_AGENT} “portalmmm|blazer|avantgo|danger|palm|series60|pal msource|pocketpc”[NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac| blaz|brew|cell|cldc|cmd-" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji |leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek |qwap|sage|sams|sany" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|m mp" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} “smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone/|wap1.|wap2.|iPhone|android”[NC]
    RewriteRule ^(.*)$ http://m.google.com [R=301,L]

    Instead I get a 500 internal error and my error_log stated this:

    -=====================================
    /home/site_dir/public_html/.htaccess: RewriteCond: bad flag delimiters
    ======================================

    Any idea how to fix this? I perfer redirect with .htaccess than java or others.
    Thanks in advance.
     
    Onesite, Jun 19, 2010 IP
  2. danydny10

    danydny10 Peon

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i want to buy cheap blogroll links related to iphone
    PM me to service @ unlock-iphone.org
     
    danydny10, Jun 26, 2010 IP