我设法通过将此代码(由 Themee)添加到我的主题目录上的 functions.php 来从 wix 重定向到 wordpress。
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');
据我了解,这仅有助于将您的访问者重定向到正确的 URL,但对 SEO 没有帮助。我认为下一个代码(在 .htaccess 文件中)应该有助于 SEO,但仍然需要一些我不知道的修改。这是来自 Google 论坛的“barryhunter”的帮助。
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=krav-maga-shirts/c9r5
RewriteRule ^$ http://www.972kravmaga.com/krav-maga-shirts [QSA,L]
它是一页重定向的示例。帮助我的人说可以检查它是否在这个页面上工作:http ://www.rexswain.com
如果有人可以确定应该在 .htacess 文件中写入的确切内容,那就太好了。