- January 4, 2018
- Posted by: Atul Raikwar
- Category: Wordpress
If you have a WordPress website or a blog then you might also face the problem of not accessing the CSS and JS file by the Googlebot. You have got this error from the search engine console. If not then this might be happening in the future. It means your website is blocked by the Googlebot, not by the WordPress CMS. After being hit by the ht access file of your website, the Googlebot visits the robot.txt file. It has the power to block the IP address.
This will affect your website’s SEO ranking. Google only rank those files which are easy to access by the users and are user-friendly. It will make a negative impact on the blocking files. It is also very easy to fix this Googlebot error. You will also get a link of instructions in the email message for fixing this issue. But that is little difficult to follow.
In this article, I will guide you how to fix the Googlebot cannot access CSS and JS files in WordPress.
So, if the JS and CSS files are blocked, the google bot unable to crawl the code. The Googlebot think it might be a spam and block these URLs.
Now the question arises is how do you come to know about the blocked files? Here is the simple solution.
Analyze your WordPress website by adding it to the Google webmaster tool. Now open option GSC on your dashboard by login to your WordPress website. Select the option Crawl and then select the Fetch as Google option. There is no need to add anything on the new page as we want to analyze our website’s home page. Now click on the red color button fetch and render. It will show you the entire fetched pages you did before. The blocked pages can also be seen by selecting blocked through Google Index. It will show you a full graph of blocked pages. But here you can only view the number of blocked pages. If you want to check all the blocked URLs, click on the URL option.
After knowing the blocked URL the next step is to use a robot.txt file to fix the error Googlebot cannot access CSS and JS files warning in WordPress.
The main role of the robot.txt file is to guide the Googlebot for the crawling of your website. The files which are very sensitive shouldn’t be crawled by the search engine.
For example: Here is a robot.txt file
This is a normal robot.txt file. But your Googlebot will get blocked if you paste little extra code into this file. You can find out the file path from the above coding very easily. In the robot file, you have to allow the access, if the file is present in any folder. If you want to edit the robot file then select the file option from your website’s Cpanel and then select the file manager. There you can easily find out the file robot.txt.
For allowing the access, you have to mention the access for JS and CSS in the robot.txt file as shown below. After this search and replace the blocked file path.
You can do this by one another method as explained below:
You can use WordPress admin panel and edit this file. You can do this by using SEO Yoast plugin. Select the tool option from the SEO option in the dashboard of your WordPress website. After this, select the file editor and the robot.txt file. Open the file and use the above-mentioned code in that file.
In this way you can fix the Googlebot cannot access js and CSS file by using C panel and SEO Yoast plugin.