Friday, February 17, 2017

Ignore urls in robot.txt with specific parameters?

http://stackoverflow.com/questions/9149782/ignore-urls-in-robot-txt-with-specific-parameters


I would like for google to ignore urls like this:
All urls that have the parameters dir, order and price should be ignored but I dont have experience with Robots.txt.
Any idea?
shareimprove this question

3 Answers

up vote68down voteaccepted
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:
shareimprove this answer
   
this will disallow new-printers I only want to disorder the querystring part – Luis Valencia - MVP Feb 5 '12 at 15:02
   
so you want to allow /new-printer but not /new-printers?dir=*&order=*&p=*?? – Book Of Zeus Feb 5 '12 at 15:05
   
yes................ – Luis Valencia - MVP Feb 5 '12 at 15:30
1 
Are those advanced wildcards and the allow directive supported well? – Tiggerito Jan 15 '13 at 14:34
6 
According to robotstxt.org/robotstxt.html - "there is no "Allow" field" – Jamie Edwards Apr 22 '13 at 9:38