2012-10-23 44 views
0

我已經採取了幾個刺,但沒有能夠擊中正確的語法。任何幫助將不勝感激。我的.htaccess文件如下所示。到目前爲止,它一直在做它應該做的事:將智能手機上的所有訪問者重定向到我的網站的移動版本。但是現在我需要添加一個命令,它可以從.htaccess的效果中排除我的文件管理器中的某些文件夾。什麼需要添加到我的代碼?如何改變我的.htaccess文件,使其忽略某些文件夾?

RewriteEngine on 
RewriteBase/

# Check if this is the noredirect query string 
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$) 
# Set a cookie, and skip the next rule 
RewriteRule^- [CO=mredir:0:www.mconchicago.com] 

RewriteCond %{HTTP:x-wap-profile} !^$ [OR] 
RewriteCond %{HTTP:Profile}  !^$ [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] 

# Check if we're not already on the mobile site 
RewriteCond %{HTTP_HOST}   !^m\. 
# Can not read and write cookie in same request, must duplicate condition 
RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) 

# Check to make sure we haven't set the cookie before 
RewriteCond %{HTTP_COOKIE}  !^.*mredir=0.*$ [NC] 

# Now redirect to the mobile site 
RewriteRule^http://m.mconchicago.com [R,L] 
+0

就像你在做什麼一樣:請確保智能手機也提供完整版本。我討厭它,當手機版本中的某些東西效果不佳時,我的手機能夠處理完整的網站就好了,但我必須更改我的瀏覽器作爲其用戶代理報告的內容,才能訪問完整網站。 – Jasper

+0

感謝您的反饋。整個網站總是有鏈接。然而,你對它的思考方式對我來說是一個新的視角。 –

回答

0

我一直在試圖找出幾個月。今晚奧德賽終於結束了。我改變了這一節:

​​

要這樣寫的:

RewriteEngine on 
RewriteRule ^family($|/) - [L] 
RewriteRule ^photos($|/) - [L] 
RewriteRule ^info($|/) - [L] 
RewriteBase/

現在,它就像一個魅力。 「家人」,「照片」和「信息」是免除.htaccess效果的文件夾。希望這個信息會爲別人節省時間。