[removed] with hash part (anchor) #

前端 未结 8 515
迷失自我
迷失自我 2020-12-28 15:46

One of our website has URL like this : example.oursite.com. We decided to move our site with an URL like this www.oursite.com/example. To do this,

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-28 16:23

    Seeing as the server will never see the # (ruling out 301 Redirects) and Google has deprecated their AJAX Crawling scheme, it seems that a front-end solution is the only way!

    How I did it:

     (function() {
    
        var redirects = [
            ['#!/about',         '/about'],
            ['#!/contact',       '/contact'],
            ['#!/page-x',        '/pageX']
        ]
    
        for (var i=0; i

    I'm assuming that because Google crawlers do indeed execute Javascript, the new pages will be indexed properly.

    I've put it in a

提交回复
热议问题