携帯サイトとWebサイトを同じURLで振り分ける方法です。 index.cgiを作って、perlで表示させる内容を変えています。 以下、index.cgiの内容です。 #!/usr/local/bin/perl $agent = $ENV{'HTTP_USER_AGENT'}; if ($agent =~ /(DoCoMo|J-PHONE|ASTEL|KDDI)/){ open(IN,"mobile.xhtml"); print "Content-type: application/xhtml+xml\n\n"; while (<IN>) { print; } close(IN); }else{ open(IN,"top.html"); print "Content-type: text/html\n\n"; while (<IN>) { print; } close(IN); } exi
![携帯サイト・Webサイト振り分けスクリプト【perl】 : 元・地方の中規模印刷会社で苦悩するWebデザイナー改めWebディレクターの日記](https://cdn-ak-scissors.b.st-hatena.com/image/square/d45f251c04cbefd944ba636d5ec4feed6ab4dc32/height=288;version=1;width=512/https%3A%2F%2Flivedoor.blogimg.jp%2Fnorisa1%2Fimgs%2Fd%2F6%2Fd6c15f1f.jpg)