Overview: From last some days many blogger, website owner are getting an alert warning message from google webmaster that Googlebot cannot access CSS and JS files on YourSitename. This new warning send by both as email and as an alert into your webmaster (Google search Console).
Check below Screenshot same I received from Google:
Then I checked PageSpeed Insights:From Google PageSpeed Insights I got this message that This page may not pass `Google's Mobile-Friendly Test`. This might be because Google has updated his algorithm so Googlebot are not able to access CSS and JS files for my website.
Then I checked for Mobile friendly:
Sad to know that both shows same warning message that its `not mobile friendly`. As this may effect on page ranking so I have to solve this as soon as possible.
How to fix this error .i.e Making Googlebot to access CSS and JS files.
Go and check your Robots.txt file. You need to edit your robots.txt file. This error occurs due to blocking in robots.txt file.
Previously this how my Robots.txt look:
User-agent: * Disallow: /wp-admin/ Disallow: /wp-includes/ Disallow: /wp-content/plugins/ Disallow: /wp-content/themes/
Method 1 :- I just change the permission set allow property for` plugin` and `themes` and this solves my problem.
My final robots.txt look like
User-agent: * Disallow: /wp-admin/ Disallow: /wp-includes/ allow: /wp-content/plugins/ allow: /wp-content/themes/
Method 2 :- Here we just give permission for Googlebot and disallow for others user agent. Using Method 2 issue will be fixed only for GoogleBot. If in future Bing / Yahoo other bot also throws same error then just apply method 1
#Googlebot User-agent: Googlebot Allow: *.css Allow: *.js # Other bot spider User-agent: * Disallow: /wp-admin/ Disallow: /wp-includes/
After editing my Robots.txt file I again went to check Mobile Friendly test. Here the result. Finally Happy to get it back :) Hope you all have also solved this issue. Hope you enjoyed this tutorial. If you have any recommendations, please let us know what you think in the comment section below! See you again next time!
If You Liked It, could you do me a favour and tell your friends !! By sharing it on Facebook, Google+ or Twitter.[txt_ads]