Wordpress, Joomla, & Drupal Solutions for Googlebot cannot access CSS and JS

Joomla Solution

Source:
http://magazine.joomla.org/issues/issue-august-2015/item/2815-googlebot-cannot-access-css-and-js-files-on

Assuming that our template is called “mytemplate”, and as a rule all templates have a / css / directory, we will open the door through robots.txt to our CSS directory, or even all of our template directories.
To do this we introduce one of the following options in our robots.txt:
Allow: / templates / mytemplate / css /
Allow: / templates / mytemplate /

 

WordPress Solution

Source:
http://www.telapost.com/js-css-wp-error/

A few ways WordPress can block these files:

robots.txt file is blocking crawling of this subfolder /wp-includes
robots.txt is blocking crawling of JS and CSS files
A security plugin such as iThemes Security is blocking JS and CSS crawling

To fix the error and allow Googlebot to crawl your JS and CSS files, take the following steps:

Check your robots.txt file. You can FTP in, use Google’s robots.txt tester, or simply visit yourwebsite.com/robots.txt. It should look something like this:

User-agent: *
Disallow: /wp-admin/

If you’re using iThemes Security, uncheck the “disable directory browsing” box. Using it blocks access to JS and CSS files via the .htaccess file.

 

Drupal Solution

Source:
http://jimbir.ch/blog/googlebot-cannot-access-css-js-your-drupal-site

To allow Googlebot to access your Javascript and CSS files, add a specific User-agent for Googlebot, repeating the rules you already have, and adding the new “Allow” rules.

Allow: /*.js*
Allow: /*.css*
Allow: /misc/*.js
Allow: /modules/*.js
Allow: /modules/*.css

Leave a Comment

Your email address will not be published. Required fields are marked *