ターゲットがホームページの場合にのみリダイレクトを実行する .htaccess に入力するコード行は何ですか? それがここでの主な質問です。詳しく説明します:
私はhtaccess を使用してモバイルをリダイレクトする Mobile Redirectで説明されている方法を使用しました。よく働く。今、私のクライアントがやろうとしているのは、誰かがモバイルを使用しているときに、ホームページではないページ (つまりブログ) にアクセスしようとしても、リダイレクトされないということです。したがって、ターゲットがホームページの場合、リダイレクトは通常どおり機能します。わかる?
では、もう一度簡単に説明します。.htaccess に入力すると、ターゲットがホームページである場合にのみリダイレクトを実行するコード行は何になりますか?
これが私が持っているものです(検出部分を除く)
RewriteCond %{REQUEST_URI} ^/index.php$ [OR]
RewriteCond %{REQUEST_URI} ^/$
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]
#there is a bunch of other user agents #
# 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.thesiteurl.com [R,L]