0
RewriteRule ^(.*)\.php$ ^(.*)\.php$?m=0 [R=301,L]
我希望所有的內頁被改寫爲?m = 0時從SITEDOTCOM?m = 0時「查看完整網站」添加?m = 0至所有
如果有人土地來得基本進入內頁到完整的網站使用尾隨?我想所有的鏈接是?m = 0
??
原因:移動重定向完整網站按鈕只能使用一次。用戶點擊某些內容時不起作用。返回到移動網站。
我的代碼看起來像這樣
RewriteEngine on
RewriteBase/
# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^|&)mobile=1(&|$)
RewriteRule^- [CO=mobile:1:%{HTTP_HOST}]
# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule^- [CO=mobile:0:%{HTTP_HOST}]
# 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} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC,OR]
RewriteCond %{HTTP:Profile} !^$
# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST} !^m\.
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie} !\mobile=0(;|$)
# Now redirect to the mobile site
RewriteRule^http://m.Site.com%{REQUEST_URI} [R,L]
試圖頂碼返回無限循環?想法?
這不會爲我工作,因爲移動網站只有2頁。添加&使手機網站404.所以我想htaccess,如果然後這樣.. – Sparxx
點擊完整的網站「mainsite?m = 0」----到達全站點首頁?m = 0 ----然後如果你點擊一個按鈕以外的其他主頁按鈕除了首頁以外的其他所有PHP頁面應該以?m = 0 – Sparxx
@Sparxx「*結尾,所以我想htaccess如果然後這樣..點擊完整的網站」mainsite?m = 0「 *「, 那是什麼意思?規則中的&簡單地匹配查詢字符串。它可以是查詢字符串的開始或其一部分。 –