WordPress, Joomla, & Drupal Solutions for “Googlebot cannot access CSS and JS”
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 /
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:
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.