当一个域名对应一个PC端和mobile端的网站时,我们需要根据浏览器的header头做跳转判断,最简单的就是通过js来实现:

<scripttype="text/javascript">varisOnPc=!(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent));if(isOnPc){self.location="/pc/index.html";}else{self.location="/mobile/index.html";}</script>