How To Fix Googlebot cannot access CSS and JS files Warning In WordPress
February 22nd, 2017 | by Ravi Chahar || 5 Comments |
Are you getting an error showing that your website is blocking Googlebot to access the CSS and the JS files?
By default, WordPress doesn’t block any of the design files. But some website owners add an extra code to improve the security which may block Googlebot.
In this tutorial, you will learn how to fix Googlebot cannot access CSS and JS files warning in WordPress. Such type of errors can influence the SEO ranking of your website.
Google tries to rank the websites which are user-friendly and easy to access. If any of the design files are blocking Googlebot, it can be a negative point.
Search For the Blocked Files from Your Google Search Console.
First of all, you should add your WordPress website to Google Search Console to analyze it. I hope you have already done that.
Now log in to your account and open the GSC dashboard.
Navigate to Crawl>>Fetch as Google and a page will appear. You don’t need to add anything extra. It’s because you’re analyzing the home page of your website.
Click on the “Fetch and Render” button and within a few seconds, it will get completed.
You will see all the paths you have fetched before.
To see those blocked pages, go to Google Index>>Blocked Resources and a graph will appear to you.
It will show the number of pages which block the Googlebot to scan your website.
To know those particular files, you can click on the URL of your website and it will show all the files.
Fix Googlebot cannot access CSS and JS Files Warning In WordPress Using the robots.txt file.
You should know that a robots.txt file handles the crawling of your website. It guides the Googlebot to crawl your website.
There are many sensitive files and folders which shouldn’t be crawled and indexed in the search engine.
The normal robots.txt file looks like this.
Many website owners copy and paste some extra code in this file which can block the Googlebot.
Sometimes, any of your plugins or themes is responsible for blocking the access. As mentioned above, you can easily find the path of that file.
Suppose the file is present in the wp-includes folder. To allow access, you have to add that file in the robots.txt file.
You can edit this file from the cPanel.
Go to cPanel>>files>>file manager>>robots.txt file. It’s just a text file and you can find it in the root directory of your website.
If you have moved your website or using any subdomain then search that folder.
To fix Googlebot cannot access CSS and JS files warning in WordPress, you have to allow the files.
Add such type of code in your robots.txt file. Don’t forget to replace the file path. It may be present somewhere else.
Another way to Edit robots.txt File.
If you’re afraid of the cPanel and using the Yoast SEO plugin then you can edit this file from your WordPress admin panel only.
Just navigate to SEO>>Tools>>File Editor and the robots.txt file will open.
Use the same type of code mentioned above. Choose the path of the file carefully. Don’t mistakenly allow the folders to get indexed which shouldn’t.
The code shown above means that you have allowed Googlebot to access only “js” file present inside the wp-includes folder.
You are still blocking access to the wp-includes folder.
After that go again to the crawling section and use the fetch and render button again. Check the number of pages blocked from the Google index.
If you don’t get any, congrats. You have successfully solved the problem. I hope now you can fix Googlebot cannot access CSS and JS files warning in WordPress. If you have any doubt, feel free to drop a comment.