将元机器人设置为/ directory / currency / switch / currency /的noindex

时间:2017-08-23 20:46:21

标签: magento magento-1.9 meta-tags

如何为www.mysite.com/directory/currency/switch/currency/USD /...?

等网页设置元机器人的无索引

我有很多这类索引的网址,我想删除它们。

1 个答案:

答案 0 :(得分:0)

您应该可以使用布局XML执行此操作。您只需要为页面找到正确的处理程序。

<your_handler_here>
   <reference name="head">
      <action method="setRobots"><value>noindex</value></action>
   </reference>
</your_handler_here>

但是,这些类型的URL应该重定向,这样才能使它们不被索引。

最简单的解决方案是将Disallow: /directory/currency/switch/currency/添加到您的robots.txt文件中,以便不允许这样做。

如果这不起作用,那么您也可以应用X-Robots-Tag标题。在Apache中,这将类似于以下内容:

<IfModule mod_headers.c>
    <FilesMatch "^directory/currency/switch">
        Header set X-Robots-Tag: "noindex"
    </FilesMatch>
</IfModule>

您可以详细了解如何实施自定义标头here

相关问题