アプリ版:「スタンプのみでお礼する」機能のリリースについて

以下のようにキャリア判別しましたが、ドコモ(f706i)
でみるとサイトが移動しました(301)が出ます。
これはなんとかならないんでしょうか?

<?php
$agent = $_SERVER['HTTP_USER_AGENT'];
if(preg_match("/^DoCoMo/i", $agent)){
header("Location: ​http://sample.com/i/index.html");
exit;
}else if(preg_match("/^(J\-PHONE|Vodafone|MOT\-[CV]|SoftBank)/i", $agent)){
header("Location: ​http://sample.com/s/index.html");
exit;
}else if(preg_match("/^KDDI\-/i", $agent) || preg_match("/UP\.Browser/i", $agent)){
header("Location: ​http://sample.com/e/index.html");
exit;
}else{
header("Location: ​http://sample.com/pc/index.html");
exit;
}
?>

A 回答 (1件)

以下のようにheader("Location: ...")の前に302レスポンスを送るとどうでしょうか。



header("HTTP/1.1 302 Found(Moved Temporary)");
header("Location: http://sample.com/i/index.html");

余談ですが、手元のドコモ端末では、header("Location: ...")だけで普通にリダイレクトします。機種(に搭載されているブラウザ)に依るところがありそうですね。
    • good
    • 0
この回答へのお礼

UmJammerさん、返事遅れましてすみません。
解決しました。ありがとうございました。

お礼日時:2009/09/17 17:22

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!