|
|
PHPを使う
|
<?
$header = getallheaders();
$agent = $header["User-Agent"] ;
if (ereg("DoCoMo", $agent)) {
header("Location: http://〇〇〇〇〇/i/");
exit;
} elseif (ereg("UP.Browser", $agent)) {
header("Location: http://〇〇〇〇〇/e/");
exit;
} elseif (ereg("J-PHONE", $agent)) {
header("Location: http://〇〇〇〇〇/v/");
exit;
} elseif (ereg("SoftBank", $agent)) {
header("Location: http://〇〇〇〇〇/v/");
exit;
} elseif (ereg("Vodafone", $agent)) {
header("Location: http://〇〇〇〇/v/");
exit;
} else {
header("Location: http://〇〇〇〇〇/pc/");
exit;
}
?>
|
〇〇〇〇〇は自分のドメイン名を入れます。
ファイル名はindex.phpとしてください。 indexファイルはこのindex.phpだけであることが条件です。
|
iはドコモ、eはAU、vはSoftBankJ-PHONE,,Vodafone、pcはパソコンです。
各フォルダーにファイルを作りサーバーに送って下さい。ファイル名はhtmlで大丈夫です。
http://〇〇〇〇〇/をクリックすると振り分けられます。
|
フォルダーは一つでいい人向き
<?
$header = getallheaders();
$agent = $header["User-Agent"] ;
if (ereg("DoCoMo", $agent)) {
header("Location: http://〇〇〇〇〇/mobile/");
exit;
} elseif (ereg("UP.Browser", $agent)) {
header("Location: http://〇〇〇〇〇/mobile/");
exit;
} elseif (ereg("J-PHONE", $agent)) {
header("Location: http://〇〇〇〇〇/mobile/");
exit;
} elseif (ereg("SoftBank", $agent)) {
header("Location: http://〇〇〇〇〇/mobile/");
exit;
} elseif (ereg("Vodafone", $agent)) {
header("Location: http://〇〇〇〇/mobile/");
exit;
} else {
header("Location: http://〇〇〇〇〇/pc/");
exit;
}
?>
mobileというフォルダー名である必要は有りません。変えてください。
この方法だと古い機種は画像が対応できません。せめて画像はJPEGにしてください。そうすると2003年以降の全機種は大丈夫です。画像がないとすべてOK
|
ここでリダイレクトされているかの表示を確認するソフト(無料)をDLする事が出来ます。
i-mode/J-Sky/auなどのブラウザ付き携帯電話(ブラウザフォン)を擬似的に実現するブラウザ
Browser Phone Browser
|
|