Wordpress 如何将一个文件夹重定向到现有文件夹,将其他文件夹重定向到具有htaccess的移动网站

Wordpress 如何将一个文件夹重定向到现有文件夹,将其他文件夹重定向到具有htaccess的移动网站,wordpress,.htaccess,redirect,mobile,Wordpress,.htaccess,Redirect,Mobile,这是我现在所拥有的,当移动设备转到somesite.com时,它会将移动设备重定向到m.somesite.com,我希望任何对somesite.com/wp content/uploads/*的呼叫都能留在somesite.com,而不是转到m.somesite.com # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] Rew

这是我现在所拥有的,当移动设备转到somesite.com时,它会将移动设备重定向到m.somesite.com,我希望任何对somesite.com/wp content/uploads/*的呼叫都能留在somesite.com,而不是转到m.somesite.com

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

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.somesite.com]

# Check if this looks like a mobile device
# (You could add another [OR] to the second one and add in what you
#  had to check, but I believe most mobile devices should send at
#  least one of these headers)
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 ^(wp-content/uploads(/.*))$ http://m.somesite.com [R,L]
RewriteRule ^ http://m.somesite.com [R,L]
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
重新启动发动机
重写基/
#检查这是否是noredirect查询字符串
RewriteCond%{QUERY_STRING}(^ |&)m=0(&|$)
#设置一个cookie,并跳过下一条规则
重写规则^-[CO=mredir:0:www.somesite.com]
#检查这是否像一个移动设备
#(你可以在第二个上再加一个[或],然后再加上你想要的
#必须检查,但我相信大多数移动设备都应该发送
#(这些标题中至少有一个)
重写条件%{HTTP:x-wap-profile}!^$[或]
重写条件%{HTTP:Profile}!^$[或]
重写COND%{HTTP|u USER|u AGENT}“acs | alav | alca | amoi | audi | aste | avan | benq | bird | blac | blaz | brew | cell | cldc | cmd-”[NC,或]
重写第2%{HTTP|u USER|u AGENT}“dang|doco|eric|hipt|inno|ipaq|java|jigs | kddi | keji|leno | lg-c | lg d | lg g | lg g | lge-”[NC,或]
重写COND%{HTTP|u USER|u AGENT}“毛伊岛|马克索|米德普|米特斯| mmef |莫比|莫托|莫托| mwbp | nec |纽特|诺基| opwv”[NC,或]
重写第2%{HTTP|u USER|u AGENT}“palm | pana | pant | pdxg | phil | play | pluc | port | prox | qwap | sage | sams | sany”[NC,或]
重写第2%{HTTP|u USER|u AGENT}“sch-| sec-| send | seri | sgh-| shar | siem | smal | smar | sony | sph-| symb | t-mo”[NC,或]
重写cond%{HTTP|u USER|u AGENT}“teli | tim | tosh | tsm | upg1 | upsi | vk-v | voda | w3cs | wap | wapa | wapi”[NC,或]
重写cond%{HTTP|u USER|u AGENT}“wapp | wapr | webc | winw | winw | xda | xda-”[NC,或]
重写cond%{HTTP_USER_AGENT}“up.browser | up.link | windowssce | iemobile | mini | mmp”[NC,或]
重写cond%{HTTP|u USER|u AGENT}“symbian | midp | wap | phone | pocket | mobile | pda | psp”[NC]
RewriteCond%{HTTP\u USER\u AGENT}!macintosh[NC]
#检查我们是否已经在移动站点上
重写cond%{HTTP_HOST}^m\。
#无法在同一请求中读取和写入cookie,必须重复条件
重写cond%{QUERY_STRING}!(^ |&)m=0(&|$)
#检查以确保我们之前没有设置cookie
重写cond%{HTTP_COOKIE}!^*mredir=0.*$[NC]
#现在重定向到移动站点
#重写规则^(可湿性粉剂内容/上传(/.*))$http://m.somesite.com [R,L]
重写规则^http://m.somesite.com [R,L]

RewriteBase/
之后添加此行:

RewriteRule ^wp-content/uploads - [L]