How to Fix Googlebot Cannot Access CSS & JS Files Warning
Fix Googlebot Cannot Access CSS & JS Files In WordPress: Are you one of many who received a warning email from Google search console saying “Googlebot cannot access CSS and JS files” on your domain name.
If yes then you must have also seen some links to instructions on how to fix this issues in that particular email. These instruction are neither descriptive nor quite easy to follow.
But before I will discuss on how to fix “Googlebot cannot access CSS and JSS files on your http://www.yourdomainname.com/” in WordPress easily let me explain exactly why you are receiving this error warning from Google Webmaster Tools (now officially Google Search Console).
Why Googlebot Needs To Access Site’s CSS & JS Files?
Earlier it was not essential to give Google access to site’s CSS & JS files. But as Google is mainly focused on giving better user experience and also better rankings to the user-friendly site, Google needs access to your theme files mainly CSS & JS files. These files help GoogleBot to better understand your site structure including visual aspects of your site like the layout, non-textual contents, etc.
Google retrieves your site and assesses your content to better understand layout and structure of your site. The information collected during the rendering process now used to compare and rank your site’s quality and value against other sites and what people are searching with Google search.
You can also check out the answer to this on their official support page.
How To Know Which Files Are Causing CSS And JS Access Issue?
Before fixing this issue, you should know which file are responsible or causing this issue. To find it out Login to Google Search Console tool (formerly Google Webmaster Tools). And Click on Crawl and then Fetch as Google. Now click on Fetch and Render button.
Wait till your request is completed. Once it is completed the result will appear in a row below. Click on that link and you will be able to see how Googlebot sees your site. Also, you can see how Google view of your site is different from visitor view of your site.
If you will see any difference between the two screenshots then this means that Googlebot was unable to access CSS and JS file on your site. You can find the list of blocked resources by going to Google Index >> Blocked Resources. Clicking on each blocked resource will show links to all that resources that Googlebot was unable to access.
In the below screenshot you can clearly find the screenshot of Google view and visitor view of BroughtMeUp. In my case, Googlebot was able to access my site’s CSS and JS file. (I also had this error and the screenshot is taken after I fixed CSS and JS error 😉 )
How To Fix Googlebot cannot access CSS and JS Files Error In WordPress
Most of the times wrong settings in Robots.txt
You can edit your Robots.txt file using FTP client such as Filezilla, Robots.txt file is usually located in your site’s root directory. OR you can also use file editor feature of Yoast SEO Plugin in your WordPress blog.
Yoast SEO is a free and very popular SEO plugin. It offers multiple features and a must use a plugin. I have already discussed this plugin. You can check out my guide:
Now if you already have Yoast SEO plugin installed then on your WordPress dashboard, Go to SEO >> Tools and then click on File Editor.
On this particular page, you can view as well as edit your site’s robots.txt file. Now you need to remove all those lines that are blocking Googlebot from accessing CSS and JS files on your site. Usually, you need to remove the following line in your robots.txt file:
In very rare cases some WordPress hosting also blocks access to default WordPress folders for bots. In this case, you can simply add following lines to the robots.txt file. Note that add this lines only when removing the above lines don't solve your problem.
Now click on Save Changes to Robots.txt. For reference you can checkout BroughtMeUp’s Robots.txt file here.
Now again go to Google Search Console and then click on Crawl >> Fetch As Google. Now again click on Fetch and Render. And then click on the link that appears in the row below and now compare Google and visitor view of your site.
Now you will be able to see that the two screenshots appear same. Now click Submit To Index on top of the screenshot to tell Google about the changes.
I hope that this article helped and you are able to resolve “Googlebot cannot access CSS and JS files” error on your WordPress site.
I hope that all your queries regarding “Googlebot cannot access CSS and JS file on http://www.yourdomainname.com" has been covered in this article. If you know any other way to fix this issue then please let us know.
If you still have any queries then let me know via comments. If you found this article helpful then please share it on Facebook and Google Plus. Also check out us on Twitter, Google+ and Facebook and do subscribe for updates.