网站上线后需要做的就是301重定向。全站301跳转到对应的三页面。 对照相关http状态码解释
通用PC端:
<script type="text/javascript">var str=window.top.location.search;var gourl=window.location.pathname;host = window.location.host;murl=host.replace(/www/,'m')if (str.indexOf('?pc')==-1){var $nav = navigator.userAgent;if($nav.match(/(iPhone|iPod|Android|ios|iPad|Linux;)/i)){if(window.location.host == host){location.href = 'http://'+murl+gourl+str;}}}</script>
通用M端;
<script>var myVar;function myFunction() {myVar = setTimeout(mobileClient, 50);}function mobileClient() {var str = window.top.location.search;var gourl = window.location.pathname;host = window.location.host;murl=host.replace(/m/,'www')var $nav = navigator.userAgent;if ($nav.match(/(Windows|Mac os;)/i)) {if (window.location.host == host) {location.href = 'http://'+murl+gourl+str;}}}myFunction();</script>
PC端:
<script language="javascript">function mobileClient () {var str=window.top.location.search;var gourl=window.location.pathname;if (str.indexOf('?pc')==-1){var $nav = navigator.userAgent;if($nav.match(/(iPhone|iPod|Android|ios|iPad|Linux;)/i)){if(window.location.host == "www.weijialiangpijm.com"){location.href = "http://m.weijialiangpijm.com"+gourl+str;}}}}mobileClient();</script>
M端:
<script type="text/javascript">var myVar;function myFunction() {myVar = setTimeout(mobileClient, 50);}function mobileClient() {var str = window.top.location.search;var gourl = window.location.pathname;var $nav = navigator.userAgent;if ($nav.match(/(Windows|Mac os;)/i)) {if (window.location.host == "m.mxbcbql.com") {location.href = "http://www.mxbcbql.com" + gourl + str;}}}myFunction();</script>
