97

Wordpress robots.txt tips against duplicate content

Posted March 3rd, 2008 by Jeremy Schoemaker

Been getting some questions about my robots.txt file and what certain things do.

Thankfully some regular expressions are supported in the robots.txt (but not many).

$ in regex means the end of the file. So if you do .php$ it your robots.txt that means it will match anything that ends in .php

This is really handy when you want to block all .exe .php or other files. For example:

Disallow: /*.PDF$
Disallow: /*.jpeg$
Disallow: /*.exe$

Specifically this is some of the things I use in my robots.txt

Disallow: /*? – this blocks all urls with a ? in them. A good way to avoid duplicate content issues with wordpress blogs. Obviously you only want to use this if you have changed your url structure to not be 100% ?=.

Disallow: /*.php$ – This blocks all .php files. Another good way to avoid duplicate content with a wordpress blog.

Disallow: /*.inc$ – you should not be showing .inc or include files to bots (google code search will eat you alive)

Disallow: /*.css$ – why would you show css files for indexing seems silly.. The wildcard is used here in case there are many css files.

Disallow: */feed/ feeds being indexed dilute your site equity. The wildcard * is used incase there is preceding chars.

Disallow: */trackback/ – no reason a trackback url should be indexed. The wildcard * is used incase there is preceding chars.

Disallow: /page/ – assloads of duplicate content in pages for wordpress.

Disallow: /tag/ – more douplicate content.

Disallow: /category/ – even more duplicate content.

SO what if you want to ALLOW a page. Like for instance my serps tool is serps.php and from the above rules that would not fly.

Allow: /serps.php – this does the trick!

Keep in mind I am not a SEO but I have picked up a few tricks along the way.

Disclaimer

Before acting on this post, be sure to read my Disclaimer.

- Comment Likes - Comment Dislikes

97 comments. What say you?

  1. Good Comment?
    bursa emlak

    Some really good info, if you are not an SEO you are pretty darn close

  2. Good Comment?
    bursa

    Ya,I dont use Disfollows..

  3. Good Comment?
    Tatil

    thank u this article and all comments

  4. Good Comment?
    Erken Rezervasyon

    I think this article has been translated into other languages in the converter to use a car very enjoyable

  5. Good Comment?
    No Regrets Cash Gifting

    Very nice article, thanks!

  6. Good Comment?
    SEO hosting

    Shoe, I just checked your actual robots.txt. Why do you have;

    Disallow: /sitemap.xml

    That seems like trouble?

  7. Good Comment?
    Chip

    Great tips, I’ll enhance my robots.txt file ASAP

  8. Good Comment?
    HardGeek

    wow!!! Never knew that..??

  9. Good Comment?
    Erica DeWolf

    Great post with some great descriptions of what these certain words will “do.” Thanks for the post!

  10. Good Comment?
    Secrets Of Cash Gifting

    Thats good that they added it, duplication is bad.

  11. Good Comment?
    Downloading...

    Thanks for this Jeremy. I have been looking for a good robots.txt file. I have no idea what to put in, so this will help.

  12. Good Comment?
    Andy Beard

    Shoe is making an “SEO Linking Gotcha”

    All the pages blocked with robots.txt will still gather juice and can still rank

    Simple proof is that my Wordpress SEO Masterclass page is still ranking after being blocked by robots.txt for a couple of weeks as it was written as a paid post – actually it is ranking higher that Joost’s similar page.

    This article explains why so many people have got this wrong for years
    http://andybeard.eu/2007/11/seo-linking-gotchas-even-the-pros-make.html

    It gets worse when people start mixing this kind of advice with their “All in one SEO” because the noindex statements added don’t get seen by googlebot.

  13. Good Comment?
    Too Much Vodka

    I agree, disallowing category and page is not the smartest move to let google find old content.

  14. Good Comment?
    Yiwu

    Why my post cann’t be displayed.

  15. Good Comment?
    Yiwu

    Ya,I dont use Disfollows..

  16. Good Comment?
    RacerX

    Do you have some before /after stats you can share? I understand the penalty, but just want to understand how it improves.

  17. Good Comment?
    Nullamatix

    Um, no. The only way to prevent those types of attacks would involve IP based content delivery.

  18. Good Comment?
    Nullamatix

    Uzair,

    How is this off topic? If Shoe thinks a robots.txt will help in SERPs, your site will get more traffic, and ultimately earn more cash. Isn’t that one of the focuses of this blog? “Skills to Pay the Bills” right?

    -Guy
    http://www.nullamatix.com

  19. Good Comment?
    Nullamatix

    I didn’t initially include a robots.txt in my blog and never had any issues with dupe content. It wasn’t until just recently I decided to add one, more for experimental purposes. So far, search engine traffic hasn’t improved or declined either way. Wordpress out of the box isn’t great for SEO purposes, but with minor tweeks, I find that a robots.txt isn’t really necessary.

    -Guy
    http://www.nullamatix.com

  20. Good Comment?
    John

    Very helpful post for me as I have been looking how to use the robots.txt file in this way for some time.

  21. Good Comment?
    Too Much Vodka

    Well, this seems to be a better version than all noindex plugins going arround. Def. will give it a try!

  22. Good Comment?
    Reynder (SEO)

    Thanks! Very useful again. Avoiding duplicate content really helped me ranking well.

  23. Good Comment?
    Dexter | Techathand.net

    Hello to all I just want to share my post regarding Robots.txt that really helps my site

  24. Good Comment?
    Dexter | Techathand.net

    This is only applicable if your Permalink is not structuterd to have year on it. Or else this will result with a mess..

  25. Good Comment?
    Affiliate Confession

    I was wondering that as well. They can find and react to all sorts of things, I think they would know about WP installs and the issues it has.

  26. Good Comment?
    Uzair

    You can also use
    Disallow: /wp
    instead of all those others like
    Disallow: /wp-admin
    Disallow: /wp-includes
    Disallow: /wp-content/plugins
    Disallow: /wp-content/cache
    Disallow: /wp-content/themes

  27. Good Comment?
    Uzair

    It does. Duplicate content ruins your site.

  28. Good Comment?
    Uzair

    Thats great. But don’t you think you are getting off topic.

  29. Good Comment?
    Charlie

    Bob,
    Why do you need to block /comments/, I thought having comments indexed would be a good thing. This is new to me so any pointers would be great.

    Thanks.

  30. Good Comment?
    Squeaky

    Thank you for posting these tips for WordPress on the robot.txt file.

  31. Good Comment?
    David Harrison

    Typo in the title? Or am i seeing things

  32. Good Comment?
    Tom Beaton

    I shall have to take another look at my robots.txt!

  33. Good Comment?
    Douglas Karr

    Thanks for these tips – I hadn’t even thought of leveraging the robots file against duplicate content (much easier than disabling those features!). Thanks!

  34. Good Comment?
    Affiliate Confession

    Thanks for the list and explaining it. I need to add a robots.txt file to my blog.

  35. Good Comment?
    Gary R. Hess

    For smaller blogs this might not be the best thing to do when it comes to SEO. If implementing everything this way, you are relying on Google to find older posts (if they don’t have links to them) by going directly through the homepage. Requiring Google to go back 20 pages to find an article is a good way to end up in the supplemental index (which, of course they claim doesn’t exist anymore, but IMO it does).

  36. Good Comment?
    Gary R. Hess

    Matt Cutts says it does.

  37. Good Comment?
    Syed Balkhi

    yeah nothing keeps them out

  38. Good Comment?
    Syed Balkhi

    Great list of tips shoe … i can bet this helps alot.

  39. Good Comment?
    TheMadHat

    Agreed that disallow will allow the bots to visit but not take the content. Maybe I said this wrong.

    Say for example you’ve got links coming into a page you’ve disallowed in robots.txt. This wastes any link juice that (linking) page is giving you. Using “meta noindex” will allow the bots to follow the links on the “meta noindexed” page and pass on the link juice, and also alleviate any dup issues.

    So has he changed his stance on the fact that a “meta noindexed” page accumulating and pass page rank? On a robots disallowed page the bots won’t take the content thereby there will be nowhere to pass page rank to.

    The way I understand it is this:

    meta noindex – don’t index but follow and pass pr
    meta nofollow – index but don’t follow links or pass any pr on entire page
    href nofollow – don’t pass pr on that link
    robots disallow – don’t index or follow or pass pr (they can reference the url still, just without content there is nowhere to pass any link juice).

  40. Good Comment?
    ShoeMoney

    I doubt its going to keep spammers out ;)

  41. Good Comment?
    ShoeMoney

    well its not really true regex… its just a somewhat adaptation

  42. Good Comment?
    ShoeMoney

    well.. just had a conversion with mr cutts about this and many other things 3 days ago.

    You are getting the Disallow and noindex tags confused in the robots.txt. Disallow will still let the bots visit and index them but not take in the content.

  43. Good Comment?
    oakling

    OMG. Will this keep spammers from doing that obnoxious thing where they copy a whole journal entry (or the majority of one) into their fake blogs, making it look like they are quoting it (“Someone said something great over at blahblahblah dot com, ‘entire post here,’”) with no other content? Just to get on google and steal my links? I’m sure they’re using robots at some stage….

  44. Good Comment?
    anty

    I wonder if Google isn’t already good at detecting a wordpress installation and can therefore react on the duplicate content accordingly (like ignoring part of the sites, indexing after a schema normal wp blogs will follow)… Just a thought :)

  45. Good Comment?
    anty

    Interesting that the question mark doesn’t have to be escaped. Normally a question mark would be a RegEx meta character, but I just looked it up in the Google guidelines: a question mark is treaded as a regular character.
    An important note: Not every crawler understands RegEx in the robots.txt. So you are “protecting” your sites against the major search engines, but not from normal bots. This is ok to avoid duplicate content, I guess.

  46. Good Comment?
    Deibson Albernas

    yes ok, Thanks, use in 28 blogs maide in brasil

  47. Good Comment?
    jtGraphic

    Thanks for the tip. I guess I have the same question as someone above. How does duplicate content hurt your ranking? Is it a consequence of PR being spread across multiple pages – or is it just a case of being penalized for duplication? I’ll have to do more research. Thanks again.

  48. Good Comment?
    Terry Tay

    Excellent post Jeremy! Every single day I’m learning something new from you it seems. Just the other day with the link rel= and now today with the robot.txt file.

    I’ve just read the basics about the robot.txt file and never really thought much more into it. It’s good we have people like you helping us out along the way.

    Thanks!
    ~Terry

  49. Good Comment?
    Paul

    Thank you for the tips.

  50. Good Comment?
    Homefinding Book

    Great tutorial – more of this please! No matter what you say, its pretty good SEO stuff.

  51. Good Comment?
    Guy

    Blocking /category/ is a good one. Just need to be careful that your Permalink structure isn’t setup to include “category” — otherwise nothing will get indexed.

    I also use the following to block the archives. Just add a new line for each year your blog has been online.

    # Block Duplicate Content From Archives
    Disallow: /2006/
    Disallow: /2007/
    Disallow: /2008/

    One more is that I use;
    Disallow: /*?*

    instead of;
    Disallow: /*?

  52. Good Comment?
    TheOfficeCubicle

    Thanks Shoe! I appreciate all you have done.

    :)

  53. Good Comment?
    Guy

    Disallow /category/ is a good one to add. Just make *extra* sure your Permalink structure isn’t set up to include “category” == otherwise nothing will be indexed.

    To help reduce DC, I also recommend blocking the archives (just add a new line for each year your blog has been online)

    # Block Duplicate Content from Archives
    Disallow: /2006/
    Disallow: /2007/
    Disallow: /2008/

    I also have this
    Disallow: /*?*

    instead of this;
    Disallow: /*?

  54. Good Comment?
    eMarketing Chat

    This is very helpful! Thanks for sharing.

  55. Good Comment?
    Exposed SEO

    lol at all the spammy comments. “I totally agree with everyone” lol

  56. Good Comment?
    Money Blog

    thanks, very helpful

  57. Good Comment?
    Paid Surveys Reviewed

    Thanks for that, really need to get to grips with this robots stuff, I am sure it helps with SEO although don’t quite understand how. :-)

  58. Good Comment?
    Mayank Rocks

    I agree there totally with the above person.

  59. Good Comment?
    Mayank Rocks

    Thanks a lot for the tips Jeremy

  60. Good Comment?
    Hustle Strategy

    it can.

  61. Good Comment?
    Solo Programmer

    I have the all-in-one seo pack which applies noindex, nofollow meta tags on the actual archive/category/tag pages. I wonder if this is still worth doing but I guess it can’t hurt.

  62. Good Comment?
    TheMadHat

    I disagree with this assessment on some level. Sure, you don’t want duplicate content and it will negatively impact your site, but using the robots.txt file to fix the problem wouldn’t be my way to go.

    The robots file tells Google not to even crawl the page. A better scenario would be to use the meta noindex and follow. This tells Google not to index the page, but it can and will still accumulate link juice to pass it on (unless this page is a dead end, then it’s pointless).

    See this interview with Matt from a few months ago for a little more in-depth conversation.

    • Good Comment?
      Unpublished Guy

      I use the robot.txt file, because I use a CMS with URL rewriting. I can’t (I don’t think) use meta tags because I have the appearance of duplicate content–not actual duplicate content. For example, teh same page might appear under the URL ./Default.aspx?tabid=1 or ./tabid/1/Default.aspx, depending on how the page is accessed. If I add meta tags, then none of pages will get indexed.

  63. Good Comment?
    Michelle

    Thanks for the excellent tips Shoe. One of my blogs had been performing amazingly until Google decided to hate it last week. These tips are just what I need to try and work out if it’s a duplicate content issue..

  64. Good Comment?
    brad

    thx for the great tips for the robots.txt and wordpress blogs

  65. Good Comment?
    Arejay

    Very Nice post! We all know how many site’s leave this simple step out (like the ebook sales people, who u do a simple site: and u find the members download area). You put it out plain and simple!!! Don’t you find it funny how people who are non seo people like you, make more money then the seo people. LOL. Have a fantastic week Shoe and everyone else! Make that $$$$$

  66. Good Comment?
    RacerX

    I am not an SEO, but I play one on the internet…

    If Shoe isn’t an expert…he is the closest thing that will talk to us!

  67. Good Comment?
    RacerX

    Big Help! Thanks. This should help a bunch.

  68. Good Comment?
    bob c

    Thanks, I copied that from another blog so I’ll fix that.

  69. Good Comment?
    Ian

    Thanks for the tips shoe. A lot of people don’t realize how much duplicate content on your site can really hurt you.

  70. Good Comment?
    ShoeMoney

    bob not sure why you need the extra /*/* after category. just /category/ should get that and all sub directories of category.

  71. Good Comment?
    bob c

    I’m about to implement this:(how does it look?)
    User-agent: *
    Disallow: /cgi-bin
    Disallow: /wp-admin
    Disallow: /wp-includes
    Disallow: /wp-content/plugins
    Disallow: /wp-content/cache
    Disallow: /wp-content/themes
    Disallow: /trackback
    Disallow: /comments
    Disallow: /category/*/*
    Disallow: */trackback
    Disallow: */comments
    Disallow: /*?*
    Disallow: /*?
    Allow: /wp-content/uploads

  72. Good Comment?
    Keith Cash

    Some really good info, if you are not an SEO you are pretty darn close

  73. Good Comment?
    bob

    I never mess around with this stuff, but does duplicate content reduce how well your site ranks overall?

Join the Discussion

*Discount rate good on new registrations only. Credits or refunds cannot be issued on previous registrations. Discount rate good through February 6, 2010, prevailing rate applies after that.