How do i block an entire category/directory with robots.txt?
-
Anyone has any idea how to block an entire product category, including all the products in that category using the robots.txt file? I'm using woocommerce in wordpress and i'd like to prevent bots from crawling every single one of products urls for now.
The confusing part right now is that i have several different url structures linking to every single one of my products for example www.mystore.com/all-products, www.mystore.com/product-category, etc etc.
I'm not really sure how i'd type it into the robots.txt file, or where to place the file.
any help would be appreciated thanks
-
Thanks for the detailed answer, i will give it a try!
-
Hi
This should do it, you place the robots.txt in the root directory of your site.
User-agent: * Disallow: /product-category/
You can check out some more examples here: http://www.seomoz.org/learn-seo/robotstxt
As for the multiple urls linking to the same pages, you will just need to check all possible variants and make sure you have them covered in the robots.txt file.
Google webmaster tools has a page where you can use to check if the robots.txt file is doing what you expect it to do (under Health -> Blocked Urls).
It might be easier to block the pages with a meta tag as described in the link above if you are running a plugin allowing this, that should take care of all the different url structures also.
Hope that helps!
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Moz bar not working on https://www.fitness-china.com/gym-equipment-names-pictures-prices
Moz bar not working on our website about gym equipment names https://www.fitness-china.com/gym-equipment-names-pictures-prices How long fix it?
On-Page Optimization | | ahislop5740 -
SEO results/title tags/desktop vs. mobile
I am trying to figure out why my title tags comes up different between desktop and mobile search results. Desktop returns my title tag as written, but on mobile I get something completely different. It's related to the site, but not anything I can read, as coded in the site (i.e. not the title tags, meta, or anywhere else). Has anyone else experienced this? My title tag is 64 characters - I know it's a little bit over, but would that cause such a weird issue as a completely different title in the search results?
On-Page Optimization | | tallyhodesign0 -
Removing entire site sections categories from an ecommerce store, best practices ?
Hi Whats best practice when removing entire site sections from an e-commerce store due to ending those lines and not having similar alternative pages to redirect them too ? Should you remove pages in GWT etc ? Any other measures to prevent probs such as 404 spikes etc ?? Cheers Dan
On-Page Optimization | | Dan-Lawrence0 -
Need suggestion: Should the user profile link be disallowed in robots.txt
I maintain a myBB based forum here. The user profile links look something like this http://www.learnqtp.com/forums/User-Ankur Now in my GWT, I can see many 404 errors for user profile links. This is primarily because we have tight control over spam and auto-profiles generated by bots. Either our moderators or our spam control software delete such spammy member profiles on a periodic basis but by then Google indexes those profiles. I am wondering, would it be a good idea to disallow User profiles links using robots.txt? Something like Disallow: /forums/User-*
On-Page Optimization | | AnkurJ0 -
If I put 'keyword/url' combination to 'stop run weekly', will it dissapear from the summary page in the on-page grader?
The summary page of the on-page grader chooses the keyword and url combination itself. Now if I choose another combination, I would like the former to dissapear from the summary page. The only option is 'stop running weekly'. But will it disappear from the list also?
On-Page Optimization | | jongeneelbv0 -
Permalink structure and categories on Joomla
Hey all, I'm handling a website for a youth telecom brand. We're migrating our website from droople to joomla with a completely new design. The entire revamp has been outsourced and I'm responsible for overseeing it. As it stands, our URL structure is something like www.xyz.com/category/item I want to change to category/child-category format: www.xyz.com/category/child-vategory/item In terms of SEO, how would this change impact results, pros and cons? Cheers.
On-Page Optimization | | HasanPK0 -
2 Duplicate pages. One Showing "/"
In SEOMoz report I have 2 pages showing that are identical in name/URL apart from the fact that one ends with the / symbol and one doesnt'. They are both showing as having too many on-page links. But one shows 106 links and the other shows 106. In clients' admin section I can only find evidence of the page without the /. I wonder if anyone could advise how best to move forward? Colin
On-Page Optimization | | NileCruises0 -
SEO Change/Version Control
Hi. Can anyone suggest apps that might be applied for SEO change/version control? I've tried using Excel and Word in the past but both fall short when dealing with multiple client sites. Nothing suitable pops up so far. Specifically I want to be able to log any on-page changes that might impact SEO for historical analysis and possible roll-back (manual) eg change date, page title, headings, url, anchor text, alt image txt, body copy etc. The ability to have one view that can be filtered in various ways including by client and by url would be ideal. Maybe this is something SEOmoz is considering for Pro campaign management? Surely there's demand... Thanks Andy
On-Page Optimization | | Bluesnapper0