homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

htaccess to redirect mobile devices

5+ Year Member

Msg#: 3614922 posted 9:19 pm on Mar 30, 2008 (gmt 0)

I'm trying to find a way using htaccess to redirect some mobile devices like nokia symbian, iphone to a specific url.

Is it possibile using htaccess?
If yes what's the rewriterule I should use?

Thank you in advance



5+ Year Member

Msg#: 3614922 posted 6:44 pm on Apr 4, 2008 (gmt 0)

I'd be interested in this too, anyone have any suggestions?


WebmasterWorld Senior Member wilderness us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 3614922 posted 7:11 pm on Apr 4, 2008 (gmt 0)

Here's a BEGINNING for you to play with.
There will be more options and restrictions required.

You do need to ask yourself some questions?
How are you going to prevent loops and a long list of existing pages that are non-compatible with these phones from being requested?

My own first inclination is to restrict these phones to a specific directory/folder.

Somebody else will need to assist with the above, as well as complicated regex which will catch all pages that are non-phone.!

RewriteCond %{HTTP_USER_AGENT} (nokia¦symbian¦iphone¦blackberry) [NC]
RewriteCond %{REQUEST_URI} !^/Phone\.html$
RewriteRule !^(page4\.html¦page2\.html¦/folder/page1\.html¦OtherFolder/page1\.html)$ [mydomain.com...] [L]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved