问题
I have a few links on google that are domain.com/results.php?name=a&address=b
The results page/parameters has now been renamed and I need to remove the existing links on google etc.
I tried
User-agent: * Disallow: /results.php
in robots.txt and then on google webmaster added the url to be removed:
domain.com/results.php
it says it was removed successfully, however when I look at google an type domain.com - the existing urls with parameters are all still there.
What am I doing wrong? There are quite a few links so I need a way to deal with all of them at once instead of one by one.
Thanks
回答1:
You could put a page at results.php, and just get it to return a 301 redirect back your home page.
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.Your-Website.com");
?>
As Google recrawls your site, the old pages will disappear. You may find this works faster than just having removed the old page.
来源:https://stackoverflow.com/questions/17069861/remove-pages-from-google-dynamic-url-robots-txt