简体   繁体   中英

Exclude folder from mobile redirect

I plan to exclude a folder www.mysite.com/ca-eng/pages/storesection/ on my full website from mobile redirection and unfortunately I do not have access to .htaccess file. My service provider charge me for every update and I used already 2 trials.

My latest version that I am prepared looks like this:

RewriteCond %{REQUEST_URI}!^/storesection/
RewriteRule (.*) http://mobile.mysite.com$/1 [R,L]

Please advise if that code will run properly.

Thank you in advance.

Full Code:

# 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] 

Assuming .htaccess is placed in root you can use this rule as your very first rule:

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM