Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

Allow directory/File in Robots.txt

         

jebernier

5:20 pm on Nov 4, 2014 (gmt 0)

10+ Year Member



According to the latest Google Webmaster suggestion, I'm trying to allow the crawling of .css & .js files in my website.

My .css is in a /modules directory and I don't want Google to crawl everything in that directory. How do I specify just a certain file(s) in that directory and have Google ignore the rest?

lucy24

6:37 pm on Nov 4, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Google, unlike many search engines, recognizes the
Allow:
directive. (For all I know, they invented it.) So you can Disallow a directory and then Allow one file within it.

If the difference is in extensions, you can also Disallow (or Allow) site-wide by extension, like
Disallow: *.midi

jebernier

5:24 pm on Nov 5, 2014 (gmt 0)

10+ Year Member



Thanks

not2easy

6:08 pm on Nov 5, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



One suggestion - before you upload a new robots.txt, test it in GWT to be sure it does what you want it to do. I have tried testing it after upload and they are still on the cached version so you might as well use their test function to get it working the way you want before you upload it.

jebernier

3:49 pm on Nov 7, 2014 (gmt 0)

10+ Year Member



Thanks not2easy