Robots.txt: how to exclude sub-directories correctly?
-
Hello here,
I am trying to figure out the correct way to tell SEs to crawls this:
http://www.mysite.com/directory/
But not this:
http://www.mysite.com/directory/sub-directory/
or this:
http://www.mysite.com/directory/sub-directory2/sub-directory/...
But with the fact I have thousands of sub-directories with almost infinite combinations, I can't put the following definitions in a manageable way:
disallow: /directory/sub-directory/
disallow: /directory/sub-directory2/
disallow: /directory/sub-directory/sub-directory/
disallow: /directory/sub-directory2/subdirectory/
etc...
I would end up having thousands of definitions to disallow all the possible sub-directory combinations.
So, is the following way a correct, better and shorter way to define what I want above:
allow: /directory/$
disallow: /directory/*
Would the above work?
Any thoughts are very welcome! Thank you in advance.
Best,
Fab.
-
I mentioned both. You add a meta robots to noindex and remove from the sitemap.
-
But google is still free to index a link/page even if it is not included in xml sitemap.
-
Install Yoast Wordpress SEO plugin and use that to restrict what is indexed and what is allowed in a sitemap.
-
I am using wordpress, Enfold theme (themeforest).
I want some files to be accessed by google, but those should not be indexed.
Here is an example: http://prntscr.com/h8918o
I have currently blocked some JS directories/files using robots.txt (check screenshot)
But due to this I am not able to pass Mobile Friendly Test on Google: http://prntscr.com/h8925z (check screenshot)
Is its possible to allow access, but use a tag like noindex in the robots.txt file. Or is there any other way out.
-
Yes, everything looks good, Webmaster Tools gave me the expected results with the following directives:
allow: /directory/$
disallow: /directory/*
Which allows this URL:
http://www.mysite.com/directory/
But doesn't allow the following one:
http://www.mysite.com/directory/sub-directory2/...
This page also gives an update similar to mine:
https://support.google.com/webmasters/answer/156449?hl=en
I think I am good! Thanks
-
Thank you Michael, it is my understanding then that my idea of doing this:
allow: /directory/$
disallow: /directory/*
Should work just fine. I will test it within Google Webmaster Tools, and let you know if any problems arise.
In the meantime if anyone else has more ideas about all this and can confirm me that would be great!
Thank you again.
-
I've always stuck to Disallow and followed -
"This is currently a bit awkward, as there is no "Allow" field. The easy way is to put all files to be disallowed into a separate directory, say "stuff", and leave the one file in the level above this directory:"
http://www.robotstxt.org/robotstxt.html
From https://developers.google.com/webmasters/control-crawl-index/docs/robots_txt this seems contradictory
|
/*
| equivalent to / | equivalent to / | Equivalent to "/" -- the trailing wildcard is ignored. |I think this post will be very useful for you - http://moz.com/community/q/allow-or-disallow-first-in-robots-txt
-
Thank you Michael,
Google and other SEs actually recognize the "allow:" command:
https://developers.google.com/webmasters/control-crawl-index/docs/robots_txt
The fact is: if I don't specify that, how can I be sure that the following single command:
disallow: /directory/*
Doesn't prevent SEs to spider the /directory/ index as I'd like to?
-
As long as you dont have directories somewhere in /* that you want indexed then I think that will work. There is no allow so you don't need the first line just
disallow: /directory/*
You can test out here- https://support.google.com/webmasters/answer/156449?rd=1
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
-
Would you pursue this paid directory link?
Hi all, I KNOW the hard and true answer to this, but I'm looking for deeper insights regarding Links like those contained on this page. I understand the by-the-book answer to this would be only pursue a paid link if it is "nofollowed" OR if it has the potential to bring in new business and traffic. My question is ....does a link like this actually pass SEO value? I see businesses killing it from an SEO standpoint with link profiles full of paid directory links like this. I also thought this conversation was more interested now that Google appears to devaluing links like this instead of issue penalties. Thoughts??
Intermediate & Advanced SEO | | RickyShockley0 -
Linking from & to in domains and sub-domains
What's the best optimised linking between sub-domains and domains? And every time we'll give website link at top with logo...do we need to link sub-domain also with all it's pages? If example.com is domain and example.com/blog is sub-domain or sub-folder... Do we need to link to example.com from /blog? Do we need to give /blog link in all pages of /blog? Is there any difference in connecting domains with sub-domains and sub-folders?
Intermediate & Advanced SEO | | vtmoz0 -
Can you expedite the correction of erroneous information on the Knowledge Graph?
I have a client who is a major player in the continuing education vertical. They have recently noticed that the Google Knowledge Graph is displaying erroneous information whenever somebody searches for their brand name (no matter the location/IP address). The brand Knowledge Graph is pulling information from a permanently closed location. Our client has multiple locations. Why Google decided to pull data from this particular (closed) location is beyond us. Our client has reclaimed the permanently closed location Google+ page and they are going to permanently delete it. However we are wondering if there is anyway to expedite the process of updating the Knowledge Graph. Is there anyway to submit feedback to Google about the KG? Is there anyway to request a Knowledge Graph correction? The erroneous "permanently closed" data is very embarrassing for our client.
Intermediate & Advanced SEO | | RosemaryB0 -
URL structure for categories, sub categories and products
Hi, I'm looking for some advice about URL hierarchy and the best way to structure URLs for SEO with regards to categories, sub categories and product pages. The way the site is set up displays the URLs as such, example: 1. /badge-accessories/ 2. /badge-accessories/plastic-wallets/ 3. /badge-accessories/plastic-wallets/clear-flexible-wallets/ I am questioning whether it would be best to keep it like this (which the site developers are suggesting) or change to something like: 1. /badge-accessories/ 2. /plastic-wallets/ 3. /clear-plastic-flexible-wallets/ Or something like: 1. /badge-accessories/ 2. /plastic-wallets/ 3. /plastic-wallets/clear-flexible-wallets/ Any advice would be appreciated. Thanks
Intermediate & Advanced SEO | | Kerry_Jones0 -
Paid for Yahoo Directory months ago, yet does not display in OSE
Hi Mozzers, How long does it normally take for your yahoo directory link to show up in Open Site Explorer? We signed up and got our link on dir.yahoo early January and still see nothing in OSE. Should I call them up and ask them to fetch the page for Google?
Intermediate & Advanced SEO | | Travis-W
Get a refund? Helps!
Thanks!0 -
Files blocked in robot.txt and seo
I use joomla and I have blocked the following in my robots.txt is there anything that is bad for seo ? User-agent: * Disallow: /administrator/ Disallow: /cache/ Disallow: /components/ Disallow: /images/ Disallow: /includes/ Disallow: /installation/ Disallow: /language/ Disallow: /libraries/ Disallow: /media/ Disallow: /modules/ Disallow: /plugins/ Disallow: /templates/ Disallow: /tmp/ Disallow: /xmlrpc/ Disallow: /mailto:myemail@myemail.com/ Disallow: /javascript:void(0) Disallow: /.pdf
Intermediate & Advanced SEO | | seoanalytics0 -
Cross Sub Domain Canonical Links
I currently have 1 website, but am planning on dividing it into sub-domains specific to geographic locations such as xxx.co.uk, xxx.it, xxx.es, etc... We are working on creating original content for the sub-sites, however upon launch many will be duplicate pages. Is there a problem with cross sub-domain canonical links? Thanks!
Intermediate & Advanced SEO | | theLotter0 -
If google ignores links from "spammy" link directories ...
Then why does SEO moz have this list: http://www.seomoz.org/dp/seo-directory ?? Included in that list are some pretty spammy looking sites such as: <colgroup><col width="345"></colgroup>
Intermediate & Advanced SEO | | adriandg
| http://www.site-sift.com/ |
| http://www.2yi.net/ |
| http://www.sevenseek.com/ |
| http://greenstalk.com/ |
| http://anthonyparsons.com/ |
| http://www.rakcha.com/ |
| http://www.goguides.org/ |
| http://gosearchbusiness.com/ |
| http://funender.com/free_link_directory/ |
| http://www.joeant.com/ |
| http://www.browse8.com/ |
| http://linkopedia.com/ |
| http://kwika.org/ |
| http://tygo.com/ |
| http://netzoning.com/ |
| http://goongee.com/ |
| http://bigall.com/ |
| http://www.incrawler.com/ |
| http://rubberstamped.org/ |
| http://lookforth.com/ |
| http://worldsiteindex.com/ |
| http://linksgiving.com/ |
| http://azoos.com/ |
| http://www.uncoverthenet.com/ |
| http://ewilla.com/ |0