Magento 将/directory/currency/switch/currency的meta robots设置为noindex/

Magento 将/directory/currency/switch/currency的meta robots设置为noindex/,magento,magento-1.9,meta-tags,Magento,Magento 1.9,Meta Tags,我如何才能为www.mysite.com/directory/currency/switch/currency/USD/…等页面将meta robots设置为noindex 我有很多这样的URL被索引,我想删除它们。您应该可以使用布局XML来完成这项工作。您只需要为页面找到正确的处理程序 <your_handler_here> <reference name="head"> <action method="setRobots"><val

我如何才能为www.mysite.com/directory/currency/switch/currency/USD/…等页面将meta robots设置为noindex


我有很多这样的URL被索引,我想删除它们。

您应该可以使用布局XML来完成这项工作。您只需要为页面找到正确的处理程序

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

您可以阅读有关如何实现自定义头的更多信息。

问题在于找到正确的处理程序。我刚刚将上面的一行添加到robots.txt文件中。@GiovanniPutignano由于页面重定向,因此不会有处理程序。我已经更新了答案,加入了一个使用apache设置
X-Robots-Tag
头的方法,这个头也会做同样的事情。我投票结束这个问题,因为堆栈溢出是一个问答网站。你的问题不是关于编程。也许你应该把它贴上去?
<IfModule mod_headers.c>
    <FilesMatch "^directory/currency/switch">
        Header set X-Robots-Tag: "noindex"
    </FilesMatch>
</IfModule>