Restrict robot access for (specific) query string (parameter) values?

橙三吉。 提交于 2019-12-10 19:30:12

问题


Using robot.txt is it possible to restrict robot access for (specific) query string (parameter) values?

ie

http://www.url.com/default.aspx  #allow
http://www.url.com/default.aspx?id=6  #allow
http://www.url.com/default.aspx?id=7  #disallow

回答1:


User-agent: *
Disallow: /default.aspx?id=7  # disallow
Disallow: /default.aspx?id=9  # disallow
Disallow: /default.aspx?id=33 # disallow

etc...

You only need to specify the url's that are disallowed. Everything else is allowed by default.




回答2:


Can just the query variable defined such as

Disallow: /default.aspx?id=*

or better still

Disallow: /?id=



来源:https://stackoverflow.com/questions/1177111/restrict-robot-access-for-specific-query-string-parameter-values

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