2015-01-13 3 views
0

문제가 있습니다. reading all of this post 이후에는 최신 브라우저 기능을 지원하지 않는 WAP 장치에만 리디렉션을 구현하려고합니다.htaccess를 사용하여 WAP 전용 전화기를 리디렉션 하시겠습니까?

예를 들어 오래된 BlackBerry가이 리디렉션을 사용하지만 Android 또는 iPhone 기기는 사용하지 않기를 원합니다.

RewriteEngine On 

RewriteCond %{HTTP:x-wap-profile} !^$ [OR] 
RewriteCond %{HTTP:Profile}  !^$ 

RewriteCond %{REQUEST_URI}   !^/wap/?$ 
RewriteRule^http://example.com/wap/ [R,L] 

이 규칙은 모든 모바일 장치를 리디렉션합니다. 어쨌든 현대적인 브라우저를 탐색 할 수 있습니까?

감사합니다.

답변

0

이것은 내가 당신이 필요하다면 someparts을 수정해야 할 수도 있습니다 내 모바일 사이트 m.mysite.com

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 



Options +FollowSymlinks 
RewriteEngine on 
RewriteBase/

# prevent looping 
RewriteCond %{HTTP_HOST} !^m.mysite.com$ 

# if the browser accepts these mime-types, it's definitely mobile, or pretending to be 
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC,OR] 

# a bunch of user agent tests 
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR] 
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox"[NC,OR] 
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR] 
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR] 
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android"[NC] 

# rewrite rules here 
RewriteRule ^(.+)\$ http://m.mysite.com/$1 [R=302,NC] 

로 리디렉션 내 워드 프레스 사이트에서 사용 작동합니다.