以下のコードで、JavaScriptを利用したユーザーエージェント判定によるPCサイト・スマホサイトの振り分けができます。
JavaScriptコード
if((navigator.userAgent.indexOf('iPhone') > 0) || (navigator.userAgent.indexOf('Android') > 0)){ document.location = "http://www.example.com/"; }
もしくは、
if(navigator.userAgent.indexOf('iPhone') > 0){ document.location = "http://www.example.com/"; }if(navigator.userAgent.indexOf('Android') > 0){ document.location = "http://www.example.com/"; }