How do I set noindex for the filter pages?

I have a little dupilicate content issue and no have an ajax navigation but I want to set noindex follow fpr the pages to get them out of google,

Any ideas how to add the meta tag to these pages ?

example URL www.example.com/furniture/wardrobes.html?cat=34&price=asc

I have used google Parameters to crawl NO URLs with the parameters and enabled Rel= Can to orginal pages


  • would this code in Head.phtml work ? <?php $url = $_SERVER['REQUEST_URI']; $needle = "?"; if (strpos($url, $needle)) : ?> <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> <?php endif; ?> – user3853 Dec 30 '13 at 17:54

Answer for this can be found here: http://doejo.com/blog/magento-how-to-add-noindex-nofollow-robots-meta-tag-or-change-meta-title-or-description-on-certain-pages/

You need the correct layout handle, for layered navigation use this code (be careful, this adds NOINDEX to unfiltered pages too!):

   <reference name="head">
      <action method="setRobots"><value>NOINDEX,FOLLOW</value></action>
  • Thank you for the response, When this is implemeted would you still use URL parameters in WMT and use NO URLS with the parameters that are causing issues ? or let google crawl pages with "cat=" and "mode=" etc ? – user3853 Dec 31 '13 at 14:54
  • I dont know what you are meaning. What os WMT? What is "NO URLS"? – Fabian Blechschmidt Jan 1 '14 at 2:39
  • Arrr... Webmaster tools in google, You can set your parameters not to be craweled (no Urls) so in this case i told it not to crawl parameters like mode= and cat= and limit= .... But in this instance do i want this as will the bots still be able to see the noindex,follow tag ? – user3853 Jan 1 '14 at 14:55
  • If anyone access the page, he/she will see noindex,follow - the crawler too. Maybe I don't understand the question? – Fabian Blechschmidt Jan 1 '14 at 21:41
  • 1
    Doesnt this add NOINDEX to the "unfilters" (read; original/canonical) category page too? I think one would like to have NOINDEX on the category pages only where a filter is active – snh_nl Nov 17 '15 at 19:36




public function changeRobots($observer){
    if($observer->getEvent()->getAction()->getFullActionName() == 'catalog_category_view') {
        $uri = $observer->getEvent()->getAction()->getRequest()->getRequestUri();
        if(stristr($uri,"?")): // looking for a ?
            $layout       = $observer->getEvent()->getLayout();
            $product_info = $layout->getBlock('head');
            $layout->getUpdate()->addUpdate('<reference name="head"><action method="setRobots"><value>NOINDEX,FOLLOW</value></action></reference>');
    return $this;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.