Daily Archives: September 30, 2013

Home »  2013 »  September »  30th (Monday)

모바일 접속시 모바일페이지로!! (  mod_rewrite  )

/usr/local/apache/conf/httpd.conf
 
 
> 모듈 로드 확인
LoadModule rewrite_module modules/mod_rewrite.so
 
> 모바일 디바이스 선언
UnsetEnv MOBILE_DEVICE
SetEnvIfNoCase User-Agent “iphone” MOBILE_DEVICE=TRUE
SetEnvIfNoCase User-Agent “android” MOBILE_DEVICE=TRUE
SetEnvIfNoCase User-Agent “ipod” MOBILE_DEVICE=TRUE
SetEnvIfNoCase User-Agent “ipad” MOBILE_DEVICE=TRUE
SetEnvIfNoCase User-Agent “midp” MOBILE_DEVICE=TRUE
 
>vhost 설정
/usr/local/apache/conf/extra/httpd-vhosts.conf
RewriteEngine on
RewriteCond %{ENV:MOBILE_DEVICE} ^TRUE$
RewriteRule ^(.*)$ http://m.msnote.co.kr$1 [L]
 
> 끝!