0

私はこれを何度か試しましたが、正しい構文を見つけることができませんでした。どんな助けでも大歓迎です。私の .htaccess ファイルは、以下のように表示されます。これまでは、スマートフォンなどのすべての訪問者を私の Web サイトのモバイル バージョンにリダイレクトしていました。しかし、ファイル マネージャーの特定のフォルダーを .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]
4

1 に答える 1

0

私は何ヶ月もこれを理解しようとしてきました。今夜、オデッセイはついに終わった。このセクションを変更しました:

RewriteEngine on
RewriteBase /

このように読むには:

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

今では魅力のように機能します。「family」、「photos」、「info」は、.htaccess の影響を受けないフォルダです。うまくいけば、この情報が他の人の時間を節約します。

于 2012-10-25T02:18:10.630 に答える