0

htaccessで次のスニペットを使用しています。

# redirect phones/tablets to mobile site
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{HTTP_HOST} !mobile\.website\.com [NC]
RewriteRule ^(.*)$ http://www.mobile.website.com/$1 [L,R=302]

ただし、モバイルアプリ内で、にAJAXリクエストを送信するとwww.website.com/mobile、すべて失敗します。これらのAJAXリクエストを送信し、それでもリダイレクトするにはどうすればよいですか?

4

1 に答える 1

1

次を使用できます。

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{HTTP_HOST} !mobile\.website\.com [NC]
RewriteCond %{REQUEST_URI} !^/mobile [NC]
RewriteRule ^(.*)$ http://www.mobile.website.com/$1 [L,R=302]

/ mobileのブロックが解除され、ajaxリクエストが機能します。

于 2012-04-17T15:00:55.250 に答える