View Single Post
Old 11-04-2010, 11:09 AM  
TheSenator
Too lazy to set a custom title
 
TheSenator's Avatar
 
Industry Role:
Join Date: Feb 2003
Location: NJ
Posts: 13,331
Best HTACCESS mobile re-direction script

What is the best HTACCESS script to re-direct mobile users to another site?

Here is what I am using currently. Do I need to add or modify anything?

Code:
#redirect mobile browsers

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

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

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

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

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

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

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

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

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

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

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

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

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

#Opera Mini detection
RewriteCond %{HTTP_USER_AGENT} ^.*opera.mini.*$ [NC]
RewriteRule ^(.*)$ http://mobile.somesite.com/ [R=301,L]
__________________
ISeekGirls.com since 2005
TheSenator is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote