Ignore URLs in robot.txt file with specific parameters?

I would like Google to ignore the urls:

http://www.mydomain.com/new-printers?dir=asc&order=price&p=3

All URLs that have dir, order and price parameters should be ignored, but I have no experience with Robots.txt.

Any idea?

+43
seo robots.txt
Feb 05 2018-12-12T00:
source share
3 answers

Here are the solutions if you want to ban query strings:

Disallow: /*?* 

or if you want to refine the query string:

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

You can also add a URL to the robots.txt file to allow

 Allow: /new-printer$ 

$ will only check /new-printer .

Additional Information:

http://code.google.com/web/controlcrawlindex/docs/robots_txt.html

http://sanzon.wordpress.com/2008/04/29/advanced-usage-of-robotstxt-w-querystrings/

+79
Feb 05 2018-12-12T00:
source share

You can lock these query string parameters with the following lines

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

So, if any URL contains dir= , order= or p= anywhere in the query string, it will be blocked.

+12
May 04 '15 at 17:51
source share

Register your site using Google WebMaster tools. There you can tell Google how to work with your settings.

Site Configuration -> URL Parameters

You should have pages that contain these parameters, which indicate that they should be excluded from indexing using the meta tag of robots. eg

+3
Feb 05 2018-12-15T00:
source share



All Articles