Ignore URLs in robot.txt with specific parameters?

I would like Google to ignore URLs like this:

In other words, all the URLs that have the parameters dir, order and price should be ignored. How do I do so with robots.txt?

0

3 Answers

Here's a solutions if you want to disallow query strings:

Disallow: /*?* 

or if you want to be more precise on your query string:

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

You can also add to the robots.txt which url to allow

Allow: /new-printer$ 

The $ will make sure only the /new-printer will be allowed.

More info:

9

You can block those specific 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.

6

Register your website with Google WebMaster Tools. There you can tell Google how to deal with your parameters.

Site Configuration -> URL Parameters

You should have the pages that contain those parameters indicate that they should be excluded from indexing via the robots meta tag. e.g.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like