Redirect URLs with #! dynamic content

2019-08-18 02:17发布

I had a temporary site made on Wix, and will soon need to move to a new one made in Zend Framework 2. For SEO reasons, not to lose the ranking gained so far, I need to 301 redirect the page URLs of the old site to pages in the new one, the problem is that Wix uses some weird addresses like www.mysite.com/#!about/etc, so the Redirect 301 rule in .htaccess doesn't work as the stuff after the # is not seen as a part of the link. How can I redirect from such URLs without losing their Google juice? Thanks.

2条回答
疯言疯语
2楼-- · 2019-08-18 02:40

This code should allow you to transfer the parameters to the final site with a 301.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^yourdomain.tld [NC]
RewriteRule ^(.*)$ http://newdomain.tld/$1 [R=301,L]
查看更多
爷的心禁止访问
3楼-- · 2019-08-18 02:45

After some more research, I found out Wix is using Ajax crawling, which is really unfriendly when you need to move away and redirect your pages, as it uses #! in the URLs. I also found out that those URLs get parsed by Google as escaped fragments, so I used

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=about/etc$
RewriteRule ^$ /about? [R=301,L]

Hope that does the job and redirects my old pages' Google juice to the new ones.

查看更多
登录 后发表回答