0
尋找基於移動重定向htaccess的代碼。該計劃是讓用戶每24小時重新定向一個名爲yyy.org的網站。的.htaccess重定向廣告
我需要做的是檢查它們是否滿足移動標準。如果他們這樣做,檢查他們是否有cookie。如果兩者都是真的,給他們一個cookie並將他們重定向到yyy.org網站。
的重寫條件:
$RewriteCond %{HTTP_USER_AGENT} (mobile|android|blackberry|brew|cldc|docomo|htc|j2me|micromax|lg|midp|mot|motorola|netfront|nokia|obigo|openweb|opera.mini|palm|psp|samsung|sanyo|sch|sonyericsson|symbian|symbos|teleca|up.browser|vodafone|wap|webos|windows.ce) [NC]
其他可能的代碼:這還沒完:
RewriteBase/
RewriteEngine On
# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^|&)mobile=1(&|$)
RewriteRule^- [CO=mobile:1:%{HTTP_HOST}:1440]
# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule^- [CO=mobile:0:%{HTTP_HOST}:1440]
# cookie can't be set and read in the same request so check
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule^- [S=1]
# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} (mobile|android|blackberry|brew|cldc|docomo|htc|j2me|micromax|lg|midp|mot|motorola|netfront|nokia|obigo|openweb|opera.mini|palm|psp|samsung|sanyo|sch|sonyericsson|symbian|symbos|teleca|up.browser|vodafone|wap|webos|windows.ce) [NC]
RewriteCond %{HTTP:Profile} !^$
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie} !\mobile=0(;|$)
# Now redirect to the mobile site
RewriteRule^http://yyyy.com%{REQUEST_URI} [R,L]
這是可能的,什麼是剩餘的代碼?
我知道它的煩人,但是這就是我需要的 – MGParisi 2013-03-02 14:15:39