Google SEO防止脏参数

Google SEO prevent dirty parameters

我们目前正在为 anguar 站点 (site.com) 使用预渲染。但是我们有一个问题。

当我们 运行 site:site.com 在 Google 中很多搜索结果链接显示如下:

site.com?ref=adirtyurl.com

我们如何防止它出现在 google 中?

我已经将其添加到我的 robots.txt 文件中,但是如果这些垃圾邮件发送者开始使用不同的参数怎么办?我想尝试完全限制它

User-agent: *
Disallow: /*?ref=*

我最终写了一些 returns 错误 404 的重写规则,但允许的参数除外:

    <rule name="BlockUrlParams" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{QUERY_STRING}" pattern="^(?!.*\b_escaped_fragment_\b)" />
        <add input="{REQUEST_URI}" pattern="\?" />          
      </conditions>
      <action type="CustomResponse" statusCode="404" statusReason="File or directory not found." statusDescription="The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable." />
    </rule>