Have you received a warning from Google Search console team saying “Googlebot cannot access CSS and JS files on http://www.yourdomain.com/”?
If your answer is yes, here is how you can fix the warning. If your answer is no, you are about to receive such email soon.efore we do that, let me explain why you and many other webmasters got this warning.
Here is how my warning email from Google team looks like:
If you haven’t received this warning email yet, instead of waiting for the email, you can take action right away.
I suggest you to login to your Google search console tool here, & go to your site dashboard. Click on Google Index > Blocked resources & see is search console is showing any blocked resources for your site.
You can click on the domain name under Host column, which will show which all specific files are blocked for search engine bots for crawling. If you see only those entries that are intentionally blocked by you for better crawling, then you don’t have to worry about anything.
But if you see files such as theme or plugins .css & .js files which is essential for site display, you need to edit your website/blog robots.txt file. This is applicable for almost all WordPress blogs & few other popular CMS.
Before I show you how to fix this issue, here is a tip for those who have submitted their site to search console just after reading this. (Easy to follow Tutorial here)
Chances are you might not see any blocked resources for your site right away, so you can use Fetch as Google feature.
Click on Crawl > Fetch as Google to add a fetch & render request that will be completed in few seconds. After that click under status to see how Google sees (Render) your site. In the below screenshot, you can see how Google view is different that a reader view for ShoutMeLoud. (Which I have fixed & shared the steps below).
This is where things get interesting as you can click on robots.txt tester to further see which line of your robots.txt file is blocking the bots from accessing your site CSS & JS file. In my case Disallow: /wp-includes/ was the culprit.
If your result is something like the same, here is how you can fix it. My guide is targeted for WordPress platform, but the process is similar for any other platform including custom CMS. BlogSpot users can learn here on editing robots.txt file on their platform.
How to fix CSS & JS Warning by editing robots.txt?
If the terms like robots.txt sounds new to you, don’t worry as you are not alone. It’s a common lingo in the SEO industry but not so popular among bloggers. Here we have two guides that will give you essential learning about it & they are not boring.
I suggest you to read it, as it will give you a great insight on a big aspect of search engine optimization. For WordPress blog, you can edit your robots.txt file using FTP click such as FileZilla or use the file editor feature of SEO by Yoast.
Yoast SEO plugin let you edit your robots.txt & .htaccess file from the WordPress dashboard. I have already talked about this earlier in this setup guide. I have also highlighted this step below.
Here is how you can access robots.txt file & edit it from your WordPress dashboard.
Inside your WordPress dashboard, click on SEO > Tools & click on file editor
On this page, you can view & edit your robots.txt file. In the majority of cases, you need to remove following line:
Depending upon how you have configured your robots.txt file, it will fix most of the warnings
As I mentioned above, Google search console tool is giving enough data for any non-SEO or a basic user to fix all warnings. Here is how Google is rendering ShoutMeLoud after editing & fixing the Robots.txt file.
For the reference, you can see ShoutMeLoud Robots.txt file here.
Why Google bots need to access theme CSS & JS files?
You might ask this question as earlier it was not essential to give Google access to your theme part. CSS & JS is not typically a part of the content & here is what I have found on official help page in answer for this question:
A web page relies on the availability of
my_script.js, which is typically run by web browsers to provide the browsers with the core textual content of the page. If
my_script.js is blocked from Google, we won’t be able to get the text content when Googlebot renders the web page.
Usually, I won’t bother much about a plugin JS file being blocked which have nothing to do with the site display. But after this mass warning email, it’s better to be safe & let Google access your site completely. In the majority of cases, you are good just to block your WP-admin area in WordPress Or sensitive (Dashboard, private area) while using any other platform.
- An easy to follow guide to learn WordPress SEO
- How I increased my WordPress blog traffic by 28% in only 48 days
I hope this detailed guide answered all your question regarding Google mass mail to webmasters regarding Google bot unable to access CSS, JS or any other file.
Do let me know if you also received similar warning mail? Have you fixed all the warnings? If you have any interesting insights to share about this issue, do share with us in the comment section below.
Subscribe on YouTube
38 thoughts on “How To Fix Googlebot Cannot Access CSS & JS Warning”
Thanks man. I have the same problem. I tried your ways and also tried to add
but it won’t work. It showed in file robot.txt but it doesn’t show any line is blocking the bots from accessing your site CSS & JS file
I tried all these steps the way you mentioned them, no success. Please help me out on this one. GoogleBot crawling rate is also dropped.
Thanks a lot for the great article. I struggled with this a lot. Finally I got it fixed thanks to you!
My sites Wp-includes pages are crawling. Should i block it or not ?? Other JS pages of wp-includes are also crawling . Should I disallow Wp-includes or not ?
Please help me.
Hi Harsh, after removing wp-includes and wp-content from robots.txt, all my respective folders file getting indexed by Google. Please help me to fix this issue. I have already submitted the remove url request to google but it again reindexed.
Use SEO by Yoast plugin as it would take care of it. The problem with your site is, your particular folder is already indexed once. Now, you need to manually remove the folder using Google Webmaster tool & have to repeat the process after every 6 monhts. (This is when they starts crawling all the URL’s you have removed using GWT removal tool). Why don’t you add index.php file so that those folder remains unbrowsable.
@harsh, Im completely new to the WordPress blogging platform and not aware about the index.php hack. Could you please let me know to prevent from directory browsing? Recently I have added “Options -Indexes” in htaccess.
Very informative article sir, i too got the same alert from google, but the error it is showing in my wp-admin . so i should remove disallow: /wp-admin/ and allow the google to crawl. i think it will be an security issue if we allow and it will be a chance of hacking also. can you suggest me please what to do and how to rectify my problem .
Hey Harsh, Thanks for this fix.
So, yesterday I followed instructions to fix the robots.txt files in my sites. Google WMT tools now sees it property. I also cleared all my caches and purged Cloudflare. In my case, I followed Yoast’s recommendations and simply made my robots.txt completely empty. I changed my robots.txt files on my sites to be completely empty.
Today, in WMT, already 24 hours later, under Google Index/Blocked Resources, it shows that every page on my sites are still “Pages with Blocked Resources”
All the blocked resources are the same type: …/wp-content/plugins/…
All have dates of 7/25/15 (when my Adsense income was cut in half too).
(Curiously, I don’t remember having that directory previously blocked, just wp-admin. But let’s say I did, just in case I don’t remember correctly.)
How long does it take for Google to clear all these errors off the Blocked Resources page? It’s been 24 hours since I fixed my robots.txt, cleared all my caches, etc. Does it take a while? Is there anything I can do to speed this up?
I have searched many article for solve this CSS and JS issue but this one is best, thanks for sharing this helpful information with screen short, I solved this CSS and JS issue and now Google easily index my both file
Thanks a lot
Knowing what directories/folders your resource files (JS/CSS) are located in would help.
Many people will block access to directories for things like themes, not realising that includes certain files the themes load up (like CSS or JS for widget styling etc.).
Harsh,you are just amazing. I don’t know how you read my mind. I got a message from Google Search Console saying that they cannot access CSS & JS files on my website. Today when I logged into ShoutMeLoud I saw the solution for the same.I could not believe this 🙂
Thanks for your comprehensive article! I got a bunch of those emails and Google’s own (pathetic) instructions didn’t help. Now I suppose I should get busy!