<script LANGUAGE="JavaScript">
var UserAgent = navigator.userAgent;
if (UserAgent.match(/iPhone|iPod|iPad|Android|Windows CE|BlackBerry|Symbian
|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia
|SonyEricsson/i) != null || UserAgent.match(/LG|SAMSUNG|Samsung/) != null)
location.href = "http://m.도메인 명";
</script>

<head></head>안에 넣어주면된다.