2017-08-15 61 views
-1

我想禁止我的网站上的搜索链接robots.txt。禁止搜索带有机器人的网站上的链接txt

后,我点击搜索提交按钮,我的URL看起来像:

example.com/searching?k=something 

我怎么能写这个URL地址到我的robots.txt文件?

我的robots.txt文件看起来是这样的:

User-agent: * 
Disallow: /admin_folder 
Sitemap: https://www.domain-address.com/sitemap.xml 
Host: www.domain-address.hu 
function search_k() 
{ 
    if($.trim($('#country_id').val()) != "") 
    { 
     //document.location = http_host+'/kereses.php?k='+$('#country_id').val(); 
     var KeyWord = encodeURIComponent($('#country_id').val()).replace(/%20/g, '+'); 
     document.location = http_host+'/searching?k='+KeyWord; 
    } 
    return false; 
} 
+0

为什么不只是使用星号? '禁止/ searchig/*' – vatavale

+0

您也可以禁用'query part'。请参阅https://stackoverflow.com/questions/1495363/how-to-disallow-all-dynamic-urls-robots-txt?rq=1 – vatavale

+0

你尝试了什么?由于你已经有了robots.txt,你知道它是如何工作的吗? (请注意,我删除了这个问题,询问您是否应该拒绝这些网址 - 这将是一个SEO问题,这是一个关键问题,这是关于[webmasters.se]的主题,但它可能已经在此问了。 – unor

回答

0

如果你想从您的网站上开始/searching检索所有的网址不允许兼容机器人,然后添加另一排除您robots.txt文件你的另一Disallow命令后:

Disallow: /searching 

有关格式的详细信息,了解更多关于the de-facto standard that most crawlers adhere to