昨日のブログを携帯対応にしてみるのエントリ後に問題発覚。
どうも、RSSリーダーを使っている場合、個別エントリに直接飛んでくるらしく、その場合、index.phpを介さないのでリダイレクト出来ない模様。
はて困ったなぁと言うことで、一日格闘……(-。-)
その間、.htaccessでリダイレクトさせてみたり、色々とやってみましたが、トップページでは色々とできるものの、個別エントリになるとどうしてもうまくいかない。
正規表現が間違っているのか何なのか、どうもダメ。
そこで、個別記事内の先頭に小細工をしてphpにて飛ばしてあげる方法をとりました。
こんな記述を各エントリアーカイブの先頭に入れてあげました。
<?
$ua = $_SERVER[“HTTP_USER_AGENT”];
if(ereg(“DoCoMo”,$ua)){
header(“Location: http://hogehoge.net/mt4i.cgi”);
exit;
}elseif(ereg(“Vodafone”,$ua)){
header(“Location: http://hogehoge.net/mt4i.cgi”);
exit;
}elseif(ereg(“SoftBank”,$ua)){
header(“Location: http://hogehoge.net/mt4i.cgi”);
exit;
}elseif(ereg(“MOT-“,$ua)){
header(“Location: http://hogehoge.net/mt4i.cgi”);
exit;
}elseif(ereg(“J-PHONE”,$ua)){
header(“Location: http://hogehoge.net/mt4i.cgi”);
exit;
}elseif(ereg(“KDDI”,$ua)){
header(“Location: http://hogehoge.net/mt4i.cgi”);
exit;
}elseif(ereg(“UP\.Browser”,$ua)){
header(“Location: http://hogehoge.net/mt4i.cgi”);
exit;
}elseif(ereg(“WILLCOM”,$ua)){
header(“Location: http://hogehoge.net/mt4i.cgi”);
exit;
}else{
}
?>
どうやらひとまずはうまくいっている様子(^。^)
Popularity: 6% [?]
Posted on 5月 30th, 2007 by snail
Filed under: MovableType | No Comments »