在建站的时候,都会将手机站和PC站绑定在 一起,在SEO搜索引擎优化中,有一定的互补作用。在我的大学里用JS来呈现出这样的结果。

用 js

例如: http://www.college-ing.com/templets/js/pc_mobile.js

在自己网站上创建一个js再调用。把那个地址 改成 自己对应的网站就ok。

JS代码绑定PC站和手机站

function is_mobile() {
var regex_match = /(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i;
var u = navigator.userAgent;
if (null == u) {return true;}
var result = regex_match.exec(u);
if (null == result) {return false} 
else {return true}
}
if (is_mobile()) {document.location.href= 'http://www.college-ing.com/';}
//else{document.location.href= 'http://www.college-ing.com/';}

在首页..里面填入调用代码