网站上线后需要做的就是301重定向。全站301跳转到对应的三页面。 对照相关http状态码解释

    通用PC端:

    1. <script type="text/javascript">
    2. var str=window.top.location.search;
    3. var gourl=window.location.pathname;
    4. host = window.location.host;
    5. murl=host.replace(/www/,'m')
    6. if (str.indexOf('?pc')==-1){
    7. var $nav = navigator.userAgent;
    8. if($nav.match(/(iPhone|iPod|Android|ios|iPad|Linux;)/i)){
    9. if(window.location.host == host){
    10. location.href = 'http://'+murl+gourl+str;
    11. }
    12. }
    13. }
    14. </script>

    通用M端;

    1. <script>
    2. var myVar;
    3. function myFunction() {
    4. myVar = setTimeout(mobileClient, 50);
    5. }
    6. function mobileClient() {
    7. var str = window.top.location.search;
    8. var gourl = window.location.pathname;
    9. host = window.location.host;
    10. murl=host.replace(/m/,'www')
    11. var $nav = navigator.userAgent;
    12. if ($nav.match(/(Windows|Mac os;)/i)) {
    13. if (window.location.host == host) {
    14. location.href = 'http://'+murl+gourl+str;
    15. }
    16. }
    17. }
    18. myFunction();
    19. </script>

    PC端:

    1. <script language="javascript">
    2. function mobileClient () {
    3. var str=window.top.location.search;
    4. var gourl=window.location.pathname;
    5. if (str.indexOf('?pc')==-1)
    6. {
    7. var $nav = navigator.userAgent;
    8. if($nav.match(/(iPhone|iPod|Android|ios|iPad|Linux;)/i)){
    9. if(window.location.host == "www.weijialiangpijm.com"){
    10. location.href = "http://m.weijialiangpijm.com"+gourl+str;
    11. }
    12. }
    13. }
    14. }
    15. mobileClient();
    16. </script>

    M端:

    1. <script type="text/javascript">
    2. var myVar;
    3. function myFunction() {
    4. myVar = setTimeout(mobileClient, 50);
    5. }
    6. function mobileClient() {
    7. var str = window.top.location.search;
    8. var gourl = window.location.pathname;
    9. var $nav = navigator.userAgent;
    10. if ($nav.match(/(Windows|Mac os;)/i)) {
    11. if (window.location.host == "m.mxbcbql.com") {
    12. location.href = "http://www.mxbcbql.com" + gourl + str;
    13. }
    14. }
    15. }
    16. myFunction();
    17. </script>