The most recent versions of Joomla no longer block the /media/
and /templates/
folders:
User-agent: *
Disallow: /administrator/
Disallow: /bin/
Disallow: /cache/
Disallow: /cli/
Disallow: /components/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /layouts/
Disallow: /libraries/
Disallow: /logs/
Disallow: /modules/
Disallow: /plugins/
Disallow: /tmp/
Not all extensions stick to the guidelines of where to place CSS and JS files etc, so a good work around is to allow Google to access these files regardless of where they are found.
You can achieve this by inserting a few lines to the start of your robots.txt
file like this:
#Googlebot
User-agent: Googlebot
Allow: *.css
Allow: *.js
User-agent: *
Disallow: /administrator/
Disallow: /bin/
Disallow: /cache/
Disallow: /cli/
Disallow: /components/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /layouts/
Disallow: /libraries/
Disallow: /logs/
Disallow: /modules/
Disallow: /plugins/
Disallow: /tmp/
EDIT:
Thanks @w3dk and @Stephen Ostermiller for the feedback! You are quite right. It is better to do something like this:
User-agent: *
Allow: *.css
Allow: *.js
Disallow: /administrator/
Disallow: /bin/
Disallow: /cache/
Disallow: /cli/
Disallow: /components/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /layouts/
Disallow: /libraries/
Disallow: /logs/
Disallow: /modules/
Disallow: /plugins/
Disallow: /tmp/
Unfortunately this does not seem to work as intended because the longer (more specific) rules override the shorter rules and the allow lines are ignored. It doesn't seem to make any difference whether the allow lines follow the disallow lines or vice versa.
The only way I can seem to get around this is by doing something like this which seems to work when I test it in Webmaster Tools:
User-agent: *
Allow: /************************************************************.css
Allow: /************************************************************.js
Disallow: /administrator/
Disallow: /bin/
Disallow: /cache/
Disallow: /cli/
Disallow: /components/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /layouts/
Disallow: /libraries/
Disallow: /logs/
Disallow: /modules/
Disallow: /plugins/
Disallow: /tmp/
EDIT 2 - BEST SOLUTION:
OK, so I did a little more research and found the answer at https://stackoverflow.com/a/30362942/1983389
It appears the most correct and most supported solution across all web crawlers is something like the following (allowing access to *.css
and *.js
files in the /bin
, /cache
, /installation
, /language
, /logs
, and /tmp
folders and possibly some of the other folders makes little sense):
User-agent: *
Allow: /administrator/*.css
Allow: /administrator/*.js
Disallow: /administrator/
Disallow: /bin/
Disallow: /cache/
Allow: /cli/*.css
Allow: /cli/*.js
Disallow: /cli/
Allow: /components/*.css
Allow: /components/*.js
Disallow: /components/
Allow: /includes/*.css
Allow: /includes/*.js
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Allow: /layouts/*.css
Allow: /layouts/*.js
Disallow: /layouts/
Allow: /libraries/*.css
Allow: /libraries/*.js
Disallow: /libraries/
Disallow: /logs/
Allow: /modules/*.css
Allow: /modules/*.js
Disallow: /modules/
Allow: /plugins/*.css
Allow: /plugins/*.js
Disallow: /plugins/
Disallow: /tmp/
robots.txt
since nobody (not even search engines now that Google is making demands on what you should not disallow) is going to follow it anyway?