1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.mobi - mobile website question - subdomain subdirectory or new domain?

Discussion in 'Domain Names & Parking' started by DarkMagicianOfChaos, Aug 2, 2010.

  1. DarkMagicianOfChaos

    DarkMagicianOfChaos Registered Member

    Joined:
    Apr 17, 2009
    Messages:
    95
    Likes Received:
    60
    Hey there, got a question.

    Let's say a business has a normal .com website and they create a simple mobile version of the site so people can get the business's basic information on their phones.

    How does the phone / search engines pick up the .mobi (same question for subdomains and subdirectories) instead of the .com, or does it even?

    Or how should this be handled?

    Thanks =)
     
  2. oxonbeef

    oxonbeef BANNED BANNED

    Joined:
    Jan 4, 2009
    Messages:
    2,242
    Likes Received:
    7,872
    You can add
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} "Windows CE" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "NetFront" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "Palm OS" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "Blazer" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "Elaine" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "^WAP.*$" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "Plucker" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "vodafone" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "iPhone" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "nokia" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "symbian" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "Opera Mini" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "BlackBerry" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "j2me" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "midp" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "htc" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "java" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "sony" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "android" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "AvantGo" [NC]
    RewriteRule (.*) http://yoursite.mobi [R,L]
    To your htaccess file but your .mobi site must be hosted on a different server
    or it will just loop. add your domain where it says yoursite.
    Or you can add this javascript to every page you wish to redirect.
    Code:
    <script type="text/javascript">(function(a,b){if(/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile|o2|opera m(ob|in)i|palm( os)?|p(ixi|re)\/|plucker|pocket|psp|smartphone|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce; (iemobile|ppc)|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))window.location=b})(navigator.userAgent||navigator.vendor||window.opera,'http://your-site-here.mobi');</script>
    Again change "your-site-here" to your domain.
     
    • Thanks Thanks x 2
    Last edited: Aug 2, 2010
  3. DarkMagicianOfChaos

    DarkMagicianOfChaos Registered Member

    Joined:
    Apr 17, 2009
    Messages:
    95
    Likes Received:
    60
    Awesome. Thanks a lot =)

    Does the same hold true with the java script about using a different host?

    Thanks again,

    DMOC
     
  4. orlandolongwood

    orlandolongwood Junior Member

    Joined:
    Aug 16, 2009
    Messages:
    137
    Likes Received:
    85
    Occupation:
    failed novelist
    Location:
    Austin, TX
    There is a handy open source site - detectmobilebrowser - that has a generator for redirects AND a list of downloadable scripts in a variety of languages - php, javascript, asp etc - that is regularly updated.
     
    • Thanks Thanks x 1
  5. DarkMagicianOfChaos

    DarkMagicianOfChaos Registered Member

    Joined:
    Apr 17, 2009
    Messages:
    95
    Likes Received:
    60
    Which is the best script to use? php, javascript etc? Also, do I just upload (for example) the php file and that's it? Or do I need to add code in the index.html?

    Thanks again,

    DMOC
     
  6. DarkMagicianOfChaos

    DarkMagicianOfChaos Registered Member

    Joined:
    Apr 17, 2009
    Messages:
    95
    Likes Received:
    60
    Hey, I don't suppose their is a way to keep the .com site showing in the mobile browser for smart phones like the iphone or droid and still send everyone else to the .mobi is there?
     
  7. oxonbeef

    oxonbeef BANNED BANNED

    Joined:
    Jan 4, 2009
    Messages:
    2,242
    Likes Received:
    7,872
    Had alot of issues with the code they generate.

    Javascript needs to be added to every page you wish to redirect. php you just add to your .htaccess file.

    Just delete iphone and android from the script.

    Here's another php.
    Code:
    <?php
    $main = "index.htm";
    $mobile = "[INSERT MOBILE SITE HERE]";
    if(
    $_SERVER['USER_AGENT']=='Mozilla/3.0 (compatible; AvantGo 3.2)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/5.0 (compatible; AvantGo 3.2; ProxiNet; Danger hiptop 1.0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='DoCoMo/1.0/P502i/c10 (Google CHTML Proxy/1.0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='DoCoMo/2.0 SH901iC(c100;TB;W24H12)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='DoCoMo/1.0/N503is/c10') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='KDDI-KC31 UP.Browser/6.2.0.5 (GUI) MMP/2.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='UP.Browser/3.04-TS14 UP.Link/3.4.4') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Vodafone/1.0/V802SE/SEJ001 Browser/SEMC-Browser/4.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='J-PHONE/5.0/V801SA/SN123456789012345 SA/0001JP Profile/MIDP-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='PDXGW/1.0 (TX=8;TY=6;GX=96;GY=64;C=G2;G=B2;GI=0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='ASTEL/1.0/J-0511.00/c10/smel') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='UP.Browser/6.1.0.1.140 (Google CHTML Proxy/1.0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/5.0 (Windows; U; Windows NT 5.1; ca; rv:1.5)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/Palm-D050; Blazer/4.3) 16;320x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.76 [en] (PalmOS; U; WebPro/3.0; Palm-Arz1)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.76 (compatible; MSIE 6.0; U; Windows 95; PalmSource; PalmOS; WebPro; Tungsten Proxyless 1.1 320x320x16)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible;MSIE 6.0;Windows95;PalmSource) Netfront/3.0;8;320x320') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible;MSIE 6.0;Windows95;PalmSource) Netfront/3.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.08 (Windows; Mobile Content Viewer/1.0) NetFront/3.2') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (PS2; PlayStation BB Navigator 1.0) NetFront/3.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (PDA; PalmOS/sony/model crdb/Revision:1.1.36(de)) NetFront/3.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (PDA; PalmOS/sony/model prmr/Revision:1.1.54 (en)) NetFront/3.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (PDA; Windows CE/0.9.3) NetFront/3.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (PDA; Windows CE/1.0.1) NetFront/3.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (PDA; SL-C750/1.0,Embedix/Qtopia/1.3.0) NetFront/3.0 Zaurus C750') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Xiino/1.0.9E [en] (v. 4.1; 153x130; g4)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='BlackBerry8703e/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/105') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='BlackBerry7130e/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/104') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='BlackBerry7250/4.0.0 Profile/MIDP-2.0 Configuration/CLDC-1.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='BlackBerry/3.6.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='BlackBerry7230/3.7.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='BlackBerry7230/3.7.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='BlackBerry7730/3.7.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='BlackBerry7730/3.7.1 UP.Link/5.1.2.5') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Gecko/20031007') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Plucker/Py-1.4') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 5.5; Windows NT) (compatible; MSIE 5.5; Windows NT)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='LG-LX550 AU-MIC-LX550/2.0 MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='LGE-CX5450 UP.Browser/6.2.2.3.d.1.103 (GUI) MMP/2.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320; HP iPAQ h6300)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='mot-V3/OE.40.79R MIB/2.2.1 profile/MIDP-2.0 configuration/CLDC-1.0 UP.Link/6.2.3.15.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; Smartphone; 176x220)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='portalmmm/2.0 N410i(c20;TB)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='NokiaN80-3/1.0552.0.7Series60/3.0Profile/MIDP-2.0Configuration/CLDC-1.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; ; Linux armv5tejl; U) Opera 8.02 [en_US] Maemo browser 0.4.31 N770/SU-18') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia7610/2.0 (5.0509.0) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0 Configuration/CLDC-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia6680/1.0 (4.04.07) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 5.0; Series80/2.0 Nokia9300/05.22 Profile/MIDP-2.0 Configuration/CLDC-1.1)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 5.0; Series80/2.0 Nokia9500/4.51 Profile/MIDP-2.0 Configuration/CLDC-1.1)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia6630/1.0 (2.3.129) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia7600/2.0 (03.01) Profile/MIDP-1.0 Configuration/CLDC-1.0 (Google WAP Proxy/1.0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='NokiaN-Gage/1.0 SymbianOS/6.1 Series60/1.2 Profile/MIDP-1.0 Configuration/CLDC-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia5140/2.0 (3.10) Profile/MIDP-2.0 Configuration/CLDC-1.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia3510i/1.0 (04.44) Profile/MIDP-1.0 Configuration/CLDC-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.1 (compatible; MSIE 5.0; Symbian OS; Nokia 6600;452) Opera 6.20 [en-US]') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia7250/1.0 (3.14) Profile/MIDP-1.0 Configuration/CLDC-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia6800/2.0 (4.17) Profile/MIDP-1.0 Configuration/CLDC-1.0 UP.Link/5.1.2.9') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Nokia3650/1.0 SymbianOS/6.1 Series60/1.2 Profile/MIDP-1.0 Configuration/CLDC-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.0; SmartPhone; Symbian OS/1.1.0) Netfront/3.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; O2 Xda 2mini; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 240x320; SPV C600; OpVer 11.1.3.5)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320; SPV M2000; OpVer 5.31.1.124)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220; SPV C500; OpVer 4.1.3.0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; Smartphone; 176x220)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/hspr-H102; Blazer/4.0) 16;320x320') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; Windows 95; PalmSource; Blazer 3.0) 16;160x160') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='UPG1 UP/4.0 (compatible; Blazer 1.0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/2.0 (compatible ; MSIE 3.02; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0(compatible; MSIE 4.01; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0(compatible; MSIE 4.01; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; RegKing; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; Windows CE)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; Windows CE)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.51 (compatible; Opera 3.62; EPOC; 640x480)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='EPOC32-WTL/2.0 (VGA) STNC-WTL/2.0(230)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Opera/8.01 (J2ME/MIDP; Opera Mini/1.1.2277/lofi/nordic/int; O2 Xda II; en; U; ssr)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SEC-SGHD410') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 6.0; j2me) ReqwirelessWeb/3.5') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='AU-MIC/1.1.4.0 20722 MMP/2.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SHARP-TQ-GX10i/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0 UP.Browser/6.1.0.6.1.d.1 (GUI) MMP/1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 5.0; Linux 2.4.18-rmk7-pxa3-embedix armv5tel; 480x640) Opera 6.0 [en]') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SIE-ME45/05 UP.Browser/5.0.1.1.102 (GUI)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SIE-S55/16 UP.Browser/6.1.0.5.c.4 (GUI) MMP/1.0 UP.Link/5.1.2.10') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='ReqwirelessWeb/3.2 S55') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SonyEricssonK610i/R1CB Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.2.3.15.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Opera/8.01 (J2ME/MIDP; Opera Mini/1.0.1479/HiFi; SonyEricsson P900; no; U; ssr)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SonyEricssonK700i/R2N SEMC-Browser/4.0.1 Profile/MIDP-2.0 Configuration/CLDC-1.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Opera/8.01 (J2ME/MIDP; Opera Mini/1.0.1479/HiFi; SonyEricsson P900; no; U; ssr)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SonyEricssonT200/R101') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.1 (compatible; MSIE5.0; Symbian OS); Opera 6.02 [de]') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SonyEricssonP800/R101 Profile/MIDP-1.0 Configuration/CLDC-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SonyEricssonP900/R101 Profile/MIDP-2.0 Configuration/CLDC-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='SonyEricssonT610/R201 Profile/MIDP-1.0 Configuration/CLDC-1.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (PSP (PlayStation Portable); 2.00)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; SprintPC-6700; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='LGE-VX8000/1.0 UP.Browser/6.2.3.1 (GUI) MMP/2.0') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.76 [en] (PalmOS; U; WebPro/3.0.1a; Palm-Cct1)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; MSN Companion 2.0; 800x600; Compaq)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2.1') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/4.74 [en] (X11; I; ProxiNet)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/2.0 (compatible; Elaine/3.0)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; 240x320)') {
    header("location: $mobile"); } elseif(
    $_SERVER['USER_AGENT']=='Mozilla/5.0 (compatible; AvantGo 3.2; ProxiNet; Danger hiptop 1.0)') {
    header("location: $mobile"); } else {
    header("location: $main"); }
    ?> 

    You can put that in a subdomain or register a .mobi.
    A point to remember is mobiles are being upgraded everyday you have to keep
    abreast of developements. A lot of the browsers on that last script are obsolete
    and remember people with old shit ain't got no money to spend anyway so you're wasting your time targeting them.

    Also, this is going to get increasingly complicated over time -- the iPad's native screen res is 1024x768, which is higher than about 20% of all desktop computers that are still running 800x600 and 640x480 formats.

    PPS: here's the iPad's signature:

    Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10
     
    Last edited: Aug 2, 2010
  8. Mobileblackhat

    Mobileblackhat Newbie

    Joined:
    Apr 25, 2010
    Messages:
    5
    Likes Received:
    0
    Occupation:
    webmaster, coder, designer, human
    Hi,

    htaccess
    If you got a big buisness you would prefer to user wurfl.

    I use this htaccess on one of my sites.

    Can´t post bcs of :

    " You are NOT allowed to post URLs, email addresses and images,
    until after you have been a member of BHW for a little longer.
    We did this is to cut down on spam. Thank you for understanding!
    If you would like to remove this limit faster please consider donating HERE"


    I use htaccess and it shares me an mobile icon behind my url on G-search.

    Display just what user need, don´t use huge images on mobile view and you´ll got it.