Welcome to WebmasterWorld Guest from 54.197.116.116

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

CellPhone Rewrite

pda redirect,cellphone redirect

   
1:24 am on Feb 24, 2010 (gmt 0)

10+ Year Member



What I would like to do is take any cellphone and redirect it to our smaller .mobi version of our website. The following is what I have so far:

RewriteEngine On
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [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|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]

Would simply throwing a RewriteRule ^(.*)$ to the end of these get the desired result?

Thank you!
3:35 am on Feb 24, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Not sure exactly what the question is...

Some of those UA fragments are too short, and will likely malfunction because they are all un-anchored and will occur as sub-strings in non-mobile user agents. For example, there's a Mozilla desktop browser called "Blackbird," which will match two of your UA fragments.

From a different angle, many of your iPhone and Blackberry users will be offended, and they will want to switch back to your "full-size" site -- At least, most of mine used to do that, so I stopped trying to redirect them.

Next, some of those fragments will match other vendors now rolling out phones at the iPhone/Blackberry level, and they too will want the full-size site.

So, you have a couple of choices: Set up a separate subdomain for mobiles, and stop trying to 'force' this, or provide a method (cookie-based, most-likely) that allows your users to override the "mobile mode" and avoid the redirect. I did this with several options, ranging from a session cookie to a three-year cookie -- the latter essentially being "forever" in mobile-device-lifespan terms.

Lastly, "throwing" that RewriteRule in there will get you a 500-Server Error, because the rule is incomplete.

Jim
3:57 am on Feb 24, 2010 (gmt 0)

10+ Year Member



Hello JD,

I am aware that it is incomplete which is why I was inquiring about it.

I agree with the newer phones but for the older phones I would like to forward them to the .mobi version of the website.
6:39 pm on Feb 25, 2010 (gmt 0)

10+ Year Member



It would be nice to have a redirect for the older phones that have resolution limitations.
8:23 pm on Feb 25, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



This is a subject ill-suited to a server forum. There are undoubtedly a dozen new phone user-agents released just this week, and we can't possibly keep up with them here in an Apache server forum.

I'd recommend looking at Web sites and services directly-related to mobile device user-agent and capability detection, where the number of people who are directly-involved will be much higher, and they can offer a level of experience unlikely to be found here.

Jim
9:40 pm on Feb 25, 2010 (gmt 0)

10+ Year Member



Hello jd, that is my point, it is not the new phones that are my concern at all and I'd rather not touch those. It would be a list of old cellphone browsers that I would like to see.
2:31 am on Feb 26, 2010 (gmt 0)

5+ Year Member



@solokron,

here is a small solution i used for my site

1) if ur site mainly only focus on mobile site and for older version of mobile device, provide wml version of site at first instant, also provide like if they want to use html, xhtml or xhtml-mp version, and yes as Jim says, enable cookies with their preferences

2) if ur r running both desktop and wireless device version of ur website, then do following:
- detect pc, mobile devices visitors of ur site
- direct pc users to website, direct smartphone, pda, iphone etc. to xhtml site(with rich functionality as available as pc version), and last direct old mobile devices to wml version with option to access pc and xhtml version

always remember, nowadays its not issue of mobile device compatibily, so always try to provide maximum functionality to mobile version of ur site

...and dont force user to directly goto ur mobile version if they dont want

- Rajendra Pondel
6:36 am on Mar 2, 2010 (gmt 0)

5+ Year Member



Hi Solokron,

For what it's worth, you may want to check out a free script (for non-commercial use) found at [detectmobilebrowsers.mobi...] It does exactly what you need, and it will save you a few headaches. ;)

-Ryan