Forum Moderators: phranque
User-agent: *
Disallow: /directory1/
Disallow: /directory2/
Disallow: /directory3/
Disallow: /directory4/
Disallow: /directory5/
Disallow: /directory6/
User-agent: google-image
Disallow: /directory1/
Disallow: /directory2/
Disallow: /directory3/
Disallow: /directory6/
I added a forward slash to the beginning of each directory name.
I don't really know if the user-agent for google-image is right, but you get the idea. Basically, you just copy all the Disallow lines for the other robots, paste them to the more specific case for google-image, then remove the Disallows for /directory4/ and /directory5/ to allow access.
You'll need to reverse the records in that code. Otherwise, ALL spiders will accept the User-agent: * record, and stop looking any further.
I want to agree with you on that one, Jim, but I can't. If you check here [robotstxt.org], you'll see that User-agent: * comes first. It works both ways. I also know that that works because I exclude robots that way.
Thanks - what's up with the preceeding slash? In 5 years, I've never used it.
My guess is that what you had before would disallow access to any directory whose name appeared in the Disallow. The slash is there to make sure that you disallow access only to files in /directoryN/ and not to files in, say, /differentDirectory/directoryN/. It's okay to use it without the slash, I guess, but if you aren't careful, you may end up disallowing access to more files than you really want.