Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x support forum
 Helicon Tech : ISAPI_Rewrite 2.x support forum
Subject Topic: redirect mobile devices Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
spulley
Newbie
Newbie


Joined: 26 September 2006
Location: United States
Online Status: Offline
Posts: 4
Posted: 09 June 2008 at 5:47pm | IP Logged Quote spulley

We're setting up a new mobile website and our new mobile provider has requested that we redirect all mobile devices to the mobile website.  I've pieced together the following rewrite rule, but it's still directing other browsers to the mobile site.. 
Code:

RewriteCond Host: ((?:www\.)?oursite\.com)
RewriteCond User-Agent: (?:AU-MIC|AUDIOVOX|Alcatel|BlackBerry|Blazer|Danger hiptop|DoCoMo/|Ericsson|Googlebot-Mobile|MSN Mobile Proxy|Handheld|iPhone|iPod|Klondike|LG-|LGE-| LGE |MOT-|NetFront|Nokia|Opera Mini|PalmOS|PalmSource|Panasonic-|SAGEM-|SAMSUNG|SGH-|SHARP-|SIE-|Samsung-|Smartphone|Sony|Symbian OS|Windows CE|nokia|portalmmm|Profile/MIDP-|UP\.Link|UP\.Browser)
RewriteRule (.*) http://mobile.oursite.com/ [I,L,R]


What am I missing.  It appears that the homepage does not get redirected, but all sub pages and directories get redirected to the mobile site.
Back to Top View spulley's Profile Search for other posts by spulley Visit spulley's Homepage
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7373
Posted: 13 June 2008 at 5:32pm | IP Logged Quote Lexey

That is because your rule has syntax errors (spaces inside the condition). Correct one will be:

RewriteCond Host: ((?:www\.)?oursite\.com)
RewriteCond User-Agent: (?:AU-MIC|AUDIOVOX|Alcatel|BlackBerry|Blazer|Danger hiptop|DoCoMo/|Ericsson|Googlebot-Mobile|MSN\sMobile\sProxy|Handheld|iPhone|iPod|Klondike|LG-|LGE-|\sLGE\s|MOT-|NetFront|Nokia|Opera\sMini|PalmOS|PalmSource|Panasonic-|SAGEM-|SAMSUNG|SGH-|SHARP-|SIE-|Samsung-|Smartphone|Sony|Symbian\sOS|Windows\sCE|nokia|portalmmm|Profile/MIDP-|UP\.Link|UP\.Browser)
RewriteRule (.*) http\://mobile.oursite.com/ [I,R]
Back to Top View Lexey's Profile Search for other posts by Lexey
 
spulley
Newbie
Newbie


Joined: 26 September 2006
Location: United States
Online Status: Offline
Posts: 4
Posted: 17 June 2008 at 2:58pm | IP Logged Quote spulley

That appears to have done the trick.  Thank you..
Back to Top View spulley's Profile Search for other posts by spulley Visit spulley's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum