Magento 1.9 SEO – Properly Setting Up Robots.txt

layered-navigationmagento-1.9robots.txt

I want to remove the pages from search engine by using robots.txt to not to index such pages.
The repeated URL's Containing the same content appear as

website.com/category.html?dir=asc&mode=list&order=price&p=anypage

Best Answer

To block those kind of URLs with robots.txt you could use the following lines:

Disallow: /*?dir=*
Disallow: /*&dir=*
Disallow: /*?mode=*
Disallow: /*&mode=*
Disallow: /*?order=*
Disallow: /*&order=*
Disallow: /*?p=*
Disallow: /*&p=*

This will tell user-agents not to access all URLs which contain ascending/decending sorting, grid/list mode, position/name/price order and pagination. To learn more about robots.txt files click here.

IMPORTANT: I'm not saying that this is the best way to deal with Magentos sorting and pagination options in relation to duplicate content. There is a lot of discussion about what really is the best way to do this. For instance, you could also use Google Webmaster Tools URLParameters to give Google information about how to handle URLs containing specific parameters. You should be very careful when trying to block URLs because you might unintentionally block the wrong pages.

Related Topic