.htaccessでのPCと携帯サイト振り分け方法

.htaccessに、下記のように記述します。
全キャリア共通の携帯ページにアクセスさせる場合↓


RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^(DoCoMo|KDDI|DDIPOKET|UP.Browser|J-PHONE|Vodafone|SoftBank)
RewriteRule ^$ /mobile/ [R]


後は保存したときにhtaccess.txtなどで保存して、FTPでアップした後に.htaccessに書き換えるだけ。
すべてのキャリアでいけるはずです。
上記の場合のディレクトリ構造は

┌─
├mobile[携帯用ディレクトリ]
│└index.html[携帯用トップページ]
├.htaccess[作成したファイル]
│index.html[PC用ページ]
└─

のような構成の場合です。mobileの部分を各自の携帯用ディレクトリに入れて使ってください。

↓各キャリアごとの場合

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} DoCoMo
RewriteRule ^$ http://example.jp/i/index.html [R]

RewriteCond %{HTTP_USER_AGENT} J-PHONE
RewriteRule ^$ http://example.jp/j/index.html [R]

RewriteCond %{HTTP_USER_AGENT} UP.Browser
RewriteRule ^$ http://example.jp/au/index.html [R]
<参照サイト>
・http://blog.n-two.jp/?eid=626802
・http://document.secure.jp/tools/htaccess/htaccess.php
・http://nakamura.noblog.net/blog/d/10133088.html
・http://d.hatena.ne.jp/ALMIC/20060727
・http://developers.softbankmobile.co.jp/dp/tool_dl/web/useragent.php

こちらから、拝借させていただきました。