Redirect URLs with #! dynamic content

孤街浪徒 提交于 2019-12-12 05:39:26

问题


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.


回答1:


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]



回答2:


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.



来源:https://stackoverflow.com/questions/28539043/redirect-urls-with-dynamic-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!