【问题标题】:Using Google Webmaster Tools "Parameters"使用谷歌网站管理员工具“参数”
【发布时间】:2012-03-20 10:44:10
【问题描述】:
我最近为我的网站编制了索引。
Google 已将主要网站编入索引为:
www.site.com/?ref=old
是否有可能在我的 Google 网站管理员工具中让 Google 忽略:
www.site.com/?ref=old 但仍然索引 www.site.com?
我如何做到这一点?
有点害怕使用 URL 参数选项。
非常感谢这里的任何指点 :-)
【问题讨论】:
标签:
query-string
sitemap
google-search-console
【解决方案1】:
您可以将其放置在您的旧网站中:
<?php
header( "Status: 301 Moved Permanently" );
header( "Location: http://www.yoursite.com/" );
exit(0);
?>
或者一个 .htaccess 文件应该可以解决问题。
RewriteEngine On
RewriteCond %{QUERY_STRING} ^ref=old
RewriteRule ^index\.php$ http://www.yoursite.com/ [L,R=301]
(未测试)
不过,GWT 参数也是一个不错的选择,可以让它不抓取 ?ref=old