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:
Disallow: /wp-includes/
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:
Example:
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.
Here is a video by Matt Cutts where he shared why you should not block Javascript & CSS:
Note:
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.
Must read:
- 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
The best and easy way to Fix this is to look at the Robots.txt File of other sites , what i did is i searched https://www.shoutmeloud.com/robots.txt and copy paste in my site 🙂
i landed to this article when i search this error , you are updating articles very fast based on our need ,Thanks Harsh
Hi Harsh, I got this message for my websites and two of them are not showing google ads now. though working fine on SmartPhone. I thought it could be an issue with my laptop but I witnessed decline in pageviews/impressions. will the “allow JS/CSS” in robots.txt file fix my issue? kindly advise
Hi
I removed the wp-incudes from my robots.txt file but still the same result is shown when I fetch & render my website.
Also, the Webmaster tool shows an error on wp-content on robots.txt file.
Is it safe to remove wp-contents line from robots.txt ?
Hey Harsh,
I have removed this line ” Disallow: /wp-includes/ ” from the robots.txt file but still robots.txt tester shows this line. Don’t know actually what is the issue. I have rechecked my robots.txt file and this line is not present but tester still shows the same error.
I ahve also submitted a request to let Google know robots.txt file has been updated. But all in vain.
Harsh thank you for your help. I was bit confused with this alert.
Its pointing to below options. Is it safe to remove?
Disallow: /wp-content/
Disallow: /wp-*
Thanks
Giri
The simplest thing is to add below code to your robot file
User-Agent: Googlebot
Allow: /*.js*
Allow: /*.css*
In addition, you can use the robots.txt testing tool in Search Console to identify if there are any other crawling issues.
This did the trick for me!
The most direct and simplest explanation I have found on this topic. Much appreciated!
you simply removed the wp-admin/include line from that file?
mine is showing. tell should i remove all from the list?
Googlebot couldn’t get all resources for this page. Here’s a list:
URL Type Reason
http://www.thenextrex.com/wp-admin/css/color-picker.min.css Style Sheet Blocked robots.txt Tester
http://www.thenextrex.com/wp-includes/js/jquery/jquery-migrate.min.js Script Temporarily unreachable
http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js Script Blocked
http://pagead2.googlesyndication.com/pagead/show_ads.js Script Blocked
https://s7.addthis.com/js/300/addthis_widget.js Script Blocked
Thank you, harsh.
I received same error. Google blocked stats.wp.com Js and Css files. So thank you for solved this issue.
Thanks Doctor. 🙂
Harsh, I have a question. How I can be sure that after removing /wp-include/ and in my case /wp-content/ from robots.txt will insure that there is no such Javascript and CSS file blocked in “Blocked Resources”?
I need some help with this.
On my WordPress Robots.txt file I see this
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
There is no option to delete the Disallow: /wp-includes/. However in Google Search Console on the robots.txt tester I have this
User-agent: *
Disallow: /wp-admin/
what do I do next?
@Tara
What you are looking at is .htaccess file. You need to edit the robots.txt file.
Hi Harsh,
Even I have the same problem what Tara had. And your reply is right. We are looking .htaccess file. On my page it says, “you don’t have robots.txt file, create one here”. So what can I do? What to add on my new robots.txt file?
I had the same problem what you explained on this article.
I mean, there are some .css and .js files blocked.
Expecting your reply as soon as possible.
Thanks.
Thanks harsh For Share this information with Detail.
Now I also also solve my site error.
This is really amazing information you share with shouters. Its will usefull for all webmasters. I share this information to my fb account
Hope this article reach to many webmasters.
Thank you haesh.
And another soulless grind through a pile of robots.txt files beckons. I swear Google’s got it in for me and everyone else gets caught up in it.
Awesome collection,thanks for sharing new updates to us…
Hi Harsh sir,
I too have gotten this email. I will do what you advised i.e. remove wp/includes. the thing that now wories me more is I saw many sites’ robots.txt and all have different ones. Even your’s is different than mine. WHat can we do about this 🙂
I on’t have the line about ninja bots should I add it?
thank you,
Swadhin
Thanks, But for people who use wordfence plugin. This is not enough to get rid the googlebot error.
I am getting this warning from Google regularly. I tried to learn about this problem on Google but couldn’t be able to resolve this issue. But, after reading your blog post I have resolved all the issues of one of my website.
Thanks you sharing such a useful post along with such an easy explanation.
i receded this email today. I was scared until I read your article. Thank you so much. Regards from Brazil.
Thanks harsh. I’m just get a message too.. thanks for your tips..
Today, some people get that alert from Google.
you’re post is fast & up to date. 🙂