.htaccess 피씨인지 모바일인지 구분분
2010. 3. 11. 14:40ㆍ99. 정리전 - IT/13. Apache 관련
RewriteEngine On
#www
RewriteCond %{HTTP_HOST} !^www\.ssucut\.com
RewriteRule (.*) http://www.ssucut.com/$1 [L,R=301]
#redirect mobile browsers
RewriteCond %{HTTP_USER_AGENT} Windows\ CE [NC,OR]
RewriteCond %{HTTP_USER_AGENT} BlackBerry [NC,OR]
RewriteCond %{HTTP_USER_AGENT} NetFront [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Opera\ Mini [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Palm\ OS [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Blazer [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Elaine [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^WAP.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Plucker [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Nokia [NC,OR]
RewriteCond %{HTTP_USER_AGENT} iPhone [NC,OR]
RewriteCond %{HTTP_USER_AGENT} AvantGo [NC]
RewriteCond $1 !^forum.php
RewriteRule ^(.*)$ /forum.php/$1 [L]
#여기부터는 알아서 사용하시길...
#샘플 1
#RewriteCond %{HTTP_HOST} !^www\.도메인\.com
#RewriteRule (.*) http://www.도메인.com/$1 [L,R=301]
#샘플 2
#RewriteCond %{HTTP_HOST} !^www\.도메인\.com$ [NC]
#RewriteCond %{HTTP_HOST} !^$
#RewriteRule ^(.*)$ http://www\.도메인\.com/$1 [L,R]
#redirect mobile browsers
RewriteCond %{HTTP_USER_AGENT} Windows\ CE [NC,OR]
RewriteCond %{HTTP_USER_AGENT} BlackBerry [NC,OR]
RewriteCond %{HTTP_USER_AGENT} NetFront [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Opera\ Mini [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Palm\ OS [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Blazer [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Elaine [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^WAP.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Plucker [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Nokia [NC,OR]
RewriteCond %{HTTP_USER_AGENT} iPhone [NC,OR]
RewriteCond %{HTTP_USER_AGENT} AvantGo [NC]
RewriteCond $1 !^forum.php
RewriteRule ^(.*)$ /forum.php/$1 [L]
기타 참고(테스트 안함)
#redirect mobile browsers
RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*Palm.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/forum.php/.*$
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC] #*SEE NOTE BELOW
RewriteRule ^(.*)$ /forum.php/ [L,R=302]