Overview: For the last some days many bloggers, website owners 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 an email and as an alert to 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 is not able to access CSS and JS files for my website.
Then I checked for Mobile-friendly:
Sad to know that both show the same warning message that it is not mobile friendly. As this may affect on-page ranking so I have to solve this as soon as possible.
How to fix this error .i.e Making Googlebot 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 the 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 to 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 the others user agents. Using Method 2 issue will be fixed only for GoogleBot. If in future Bing / Yahoo other bots also throw the 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 the Mobile-Friendly test. Here is the result.
Finally Happy to get it back :) Hope you all have also solved this issue.
Thank you for reading, pls keep visiting this blog and share this in your network. Also, I would love to hear your opinions down in the comments.
PS: If you found this content valuable and want to thank me? 👳 Buy Me a Coffee