나는 jQuery 모바일 사이트를 만들었습니다. 원본 사이트의 FTP에이 디렉토리를 업로드하고 싶습니다. 이제 모바일 장치에서만 모바일 사이트를 감지하려고합니다. 그 이유는 모바일 장치에서만 모바일 버전을 열 수 있기 때문입니다. 내 사이트 URL www.example.com이 데스크톱 사이트에 열려 있어야합니다. 과 다른 사이트는 www.example/mobile 사이트에서 모바일 사이트가 열려 있어야 함을 의미합니다.모바일 버전의 사이트에 .htaccess 파일 사용
나는이
# don't apply the rules if you're already in the mobile directory, infintine loop
# you'll want to test against the host if you're using a subdomain
RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
# 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]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ /mobiledirectoryhere/ [L,R=302]
같은 모바일 버전을 감지 documention를 발견하고 난 "모바일"내 모바일 버전 사이트 디렉토리에 "mobiledirectoryhere"로 변경. 그 후 나는 FTP로 파일을 업로드하고 내가 내 사이트 탐지를위한 쉬운 솔루션을 가지고 참조 사이트 http://ohryan.ca/blog/2010/04/10/how-to-detect-mobile-visitors-using-htaccess-rewrite-rules-simplified/
무엇이 질문입니까? – shanabus
죄송합니다. 해당 코드를 사용했지만 작동하지 않았습니다. – Rain
그게 무슨 일을합니까? 상태 코드를 얻었습니까? 명령어에 – shanabus