[英]Exclude folder from mobile redirect
我計划從移動重定向中排除我的完整網站上的文件夾www.mysite.com/ca-eng/pages/storesection/,很遺憾,我無法訪問.htaccess文件。 我的服務提供商向我收取每次更新的費用,並且我已經使用了2次試用版。
我准備的最新版本如下:
RewriteCond %{REQUEST_URI}!^/storesection/
RewriteRule (.*) http://mobile.mysite.com$/1 [R,L]
請告知該代碼是否可以正常運行。
先感謝您。
完整代碼:
# stop_mobi cookie management
RewriteCond %{QUERY_STRING} stop_mobi=yes
RewriteRule .*- [CO=stop_mobi:yes:.mysite.com:30]
RewriteCond %{HTTP_COOKIE} stop_mobi=yes
RewriteCond %{QUERY_STRING} !stop_mobi=no
RewriteRule .*- [CO=stop_mobi:yes:.mysite.com:30]
RewriteCond %{QUERY_STRING} stop_mobi=no
RewriteRule .*- [CO=stop_mobi:yes:.mysite.com:-30]
# mobile agents check
RewriteCond %{HTTP_USER_AGENT} Android [OR]
RewriteCond %{HTTP_USER_AGENT} AU-MIC [OR]
RewriteCond %{HTTP_USER_AGENT} AUDIOVOX- [OR]
RewriteCond %{HTTP_USER_AGENT} Alcatel [OR]
RewriteCond %{HTTP_USER_AGENT} BB10 [OR]
RewriteCond %{HTTP_USER_AGENT} BlackBerry [OR]
RewriteCond %{HTTP_USER_AGENT} Blazer [OR]
RewriteCond %{HTTP_USER_AGENT} Danger\ hiptop [OR]
RewriteCond %{HTTP_USER_AGENT} DoCoMo/ [OR]
RewriteCond %{HTTP_USER_AGENT} Ericsson [OR]
RewriteCond %{HTTP_USER_AGENT} Googlebot-Mobile [OR]
RewriteCond %{HTTP_USER_AGENT} MSN\ Mobile\ Proxy [OR]
RewriteCond %{HTTP_USER_AGENT} Handheld [OR]
RewriteCond %{HTTP_USER_AGENT} HTC_HD2_T58585\ Opera [OR]
RewriteCond %{HTTP_USER_AGENT} iPhone [OR]
RewriteCond %{HTTP_USER_AGENT} iPod [OR]
RewriteCond %{HTTP_USER_AGENT} Klondike [OR]
RewriteCond %{HTTP_USER_AGENT} LG- [OR]
RewriteCond %{HTTP_USER_AGENT} LGE- [OR]
#RewriteCond %{HTTP_USER_AGENT} \LGE\ [OR]
RewriteCond %{HTTP_USER_AGENT} MOT- [OR]
RewriteCond %{HTTP_USER_AGENT} NetFront [OR]
RewriteCond %{HTTP_USER_AGENT} Nokia [OR]
RewriteCond %{HTTP_USER_AGENT} NokiaN8 [OR]
RewriteCond %{HTTP_USER_AGENT} Novarra-Vision [OR]
RewriteCond %{HTTP_USER_AGENT} Opera\ Mini [OR]
RewriteCond %{HTTP_USER_AGENT} PalmOS [OR]
RewriteCond %{HTTP_USER_AGENT} PalmSource [OR]
RewriteCond %{HTTP_USER_AGENT} Panasonic- [OR]
RewriteCond %{HTTP_USER_AGENT} SAGEM- [OR]
RewriteCond %{HTTP_USER_AGENT} SAMSUNG [OR]
RewriteCond %{HTTP_USER_AGENT} SGH- [OR]
RewriteCond %{HTTP_USER_AGENT} SHARP- [OR]
RewriteCond %{HTTP_USER_AGENT} SIE- [OR]
RewriteCond %{HTTP_USER_AGENT} Samsung- [OR]
RewriteCond %{HTTP_USER_AGENT} Smartphone [OR]
RewriteCond %{HTTP_USER_AGENT} Sony [OR]
RewriteCond %{HTTP_USER_AGENT} Symbian\ OS [OR]
RewriteCond %{HTTP_USER_AGENT} webOS [OR]
RewriteCond %{HTTP_USER_AGENT} Windows\ CE [OR]
RewriteCond %{HTTP_USER_AGENT} Windows\ Mobile [OR]
RewriteCond %{HTTP_USER_AGENT} Windows\ Phone [OR]
RewriteCond %{HTTP_USER_AGENT} nokia [OR]
RewriteCond %{HTTP_USER_AGENT} portalmmm [OR]
RewriteCond %{HTTP_USER_AGENT} Profile/MIDP- [OR]
RewriteCond %{HTTP_USER_AGENT} UP.Link [OR]
RewriteCond %{HTTP_USER_AGENT} UP.Browser [OR]
RewriteCond %{HTTP_USER_AGENT} XV6875
RewriteCond %{HTTP_USER_AGENT} !UsableNet [NC]
# stop_mobi check
RewriteCond %{HTTP_COOKIE} !stop_mobi=yes
RewriteCond %{QUERY_STRING} !stop_mobi=yes
# execute redirect
RewriteCond %{REQUEST_URI}!^/pages/storesection/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.(jpeg|gif|bmp|png|tiff|css|js)$
RewriteRule (.*) http://mobile.mysite.com$1 [R,L]
假設.htaccess放在根目錄中,則可以將此規則用作第一個規則:
RewriteEngine On
RewriteCond %{REQUEST_URI} !/(ca-eng|ca-fre|us)/pages/storesection/
RewriteRule !\.(?:jpe?g|gif|bmp|png|tiff|css|js)$ http://mobile.mysite.com%{REQUEST_URI} [R,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.