301 Redirect from Wix to WordPress

后端 未结 3 1615
花落未央
花落未央 2021-01-24 01:50

A company I\'m working for had a WIX based site. I recreated the site on WordPress moved the hosting and redirected the domain. I then attempted to do the page redirects to the

相关标签:
3条回答
  • 2021-01-24 02:38

    i managed to redirect from wix to wordpress by adding this code (by Themee) to the functions.php on my theme directory.

    function themee_hash_redirects() {
        ?>
        <script type="text/javascript">
            function themee_hashtag_redirect( hashtag, url) {
                var locationHash = document.location.hash;
                if ( locationHash.match(/#!/img) ) {
                    if ( hashtag == locationHash ) {
                        document.location.href = url;
                    }
                }
            }
            // Examples how to use themee_hashtag_redirect
            themee_hashtag_redirect('#!dvd-content/c1yws', '/dvd-content/');
            themee_hashtag_redirect('#!krav-maga-shirts/c9r5', '/krav-maga-shirts/');
        </script>
    <?php
    }
    add_action('wp_footer', 'themee_hash_redirects');
    

    as i understood, this only help to redirect your visitors to the correct URL, but not help to SEO. i think the next code (in the .htaccess file) should help SEO, but still need some modification that i dont know about. this was an help by "barryhunter" from Google Forum.

    RewriteCond %{QUERY_STRING} ^_escaped_fragment_=krav-maga-shirts/c9r5
    RewriteRule ^$ http://www.972kravmaga.com/krav-maga-shirts [QSA,L]
    

    its an example of one page redirect. the person who helped me said can check if its working on this page: http://www.rexswain.com

    its will be nice if someone can determine what exactly should be written in the .htacess file.

    0 讨论(0)
  • 2021-01-24 02:42

    I had the same situation. The only solution I found is to create redirect.js file with the following content:

    var hashesarr = { "#!about-us/c1it7":'/about-us/',
    "#!patio-covers/ce54":'/patio-covers/',
    "#!lattice/c1mz":'/patio-covers/lattice/' };
    
    for (var hash in hashesarr) {
        var patt = new RegExp(hash);
        if (window.location.hash.match(patt) !== null) {
            window.location.href = hashesarr[hash];
        }
    }
    

    Then you should upload this file to your server and include it between <head></head> tags. This should do the trick.

    0 讨论(0)
  • 2021-01-24 02:44

    Since wix URLs are hashtags, they cannot be redirected via .htaccess. You must use javascript to redirect urls, e.g.:

    var redirects = {
        '#!about/c10fk':'about',
        '#!contact/c10fk':'contact',
        '#!help/c10fk':'help'
    };
    
    if(window.location.hash != '' && redirects.hasOwnProperty(window.location.hash)) {
        window.location.replace(redirects[window.location.hash]);
    }
    
    0 讨论(0)
提交回复
热议问题