remove pages from google dynamic url - robots.txt

落爺英雄遲暮 提交于 2019-12-24 18:06:12

问题


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

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