Mobile phone redirect Code for apache

RewriteEngine On

#redirect mobile browser using HTTP_ACCEPT header
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC]
RewriteCond %{HTTP_HOST} "!m.yourmobileurl.com" [NC]
RewriteRule (.*) http://m.yourmobileurl.com/$1 [L]

#some high-end phone sometimes support HTML, only its sucks
#add more browser user agent sig here
RewriteCond %{HTTP_USER_AGENT} (nokia|symbian|iphone|blackberry) [NC]
RewriteCond %{HTTP_HOST} "!m.yourmobileurl.com" [NC]
RewriteRule (.*) http://m.yourmobileurl.com/$1 [L]