Have you ever faced trouble with Googlebot cannot access CSS and JS files Error in Google webmaster tools account for your website? This Googlebot cannot access CSS and JS files warning contains instruction links on how to resolve this issue, but it is little bit difficult to follow. So, here we have provided the best and simple ways to fix Googlebot cannot access CSS Error. Take a look at it and Learn how to resolve Google bot cannot access CSS and JS files Error easily.
Fixing Googlebot cannot access CSS and JS files
Actually, WordPress does not block the search bots to access any CSS or JS files. Sometimes the site owners may accidentally block the access while trying to add extra security measures or by using a Security WordPress Plugin. This will restrict Googlebot from indexing CSS and JS files that may affect your WordPress website SEO performance. So, you have to learn how to unblock access to CSS or JS files.
How to Give Google Access to CSS and JS Files?
First of all, you have to know which files are Google unable to access on your WordPress website. For that, follow the given step by step process.
- Login to your WordPress site Webmaster Tools account.
- Click on Fetch as Google under Crawl Section.
- Click on the fetch and render button.
- Once fetching is completed, the result will display in a row below.
- Next, click on the displayed result. It will show you how Googlebot sees and how a visitor sees when it loads your WordPress website.
- If you see any difference between the displayed two screenshots, then this means the Googlebot was unable to access CSS and JS files. This will show you the links of CSS /JS files those unable to access.
- Next, click on the Blocked Resources under Google Index to see a list of blocked resources.
- By clicking on the each blocked resource, you will see the actual resources links that cannot be accessed by Googlebot.
Most commonly, the actual resources that cannot be accessed by Googlebot are JS files and CSS styles added by your plugins or theme. Now, you need to edit your WordPress Website’s robots.txt file to know what controls what Google bot sees. You are able to edit it by connecting to your WordPress site through an FTP client. The robots.txt file is available at your website’s root directory.
If you are using WordPress Yoast SEO plugin, then you can edit the robots.txt file from your WordPress admin area. Follow the given steps to edit robots.txt file using Yoast SEO WordPress Plugin.
- Go to your WordPress admin area,
- Click on Tools option under SEO section.
- Again click on the File Editor.
- Now, you can see the disallowed access to some directories like this:
User-agent: * Disallow: /wp-admin/ Disallow: /wp-includes/ Disallow: /wp-content/themes/ Disallow: /wp-content/plugins/
Now you have to remove the lines which are blocking Google access to CSS or JS files on your WordPress website’s front-end. Technically, these files are located in the themes or plugins folders. You can also need to remove wp-includes because there are so many WordPress themes and WordPress plugins that may call scripts located in the wp-includes folder, such as jQuery.
Some WordPress users may notice that their website’s robots.txt file is empty or does not even exist. If the Googlebot does not see a robots.txt file, then it can automatically crawl and index all your WordPress site files.
On rare cases, some of the WordPress hosting providers may block access to default folders of WordPress for bots. You can override this in the robots.txt file by allowing access to those blocked folders.
User-agent: * Allow: /wp-includes/js/
After allowing access, save robots.txt file. Next, visit your webmaster tools account and click on fetch and render button under Fetch as Google tool. Now, you have to compare your fetch results, and you can see that blockedA resources issue will be resolved.
We hope this article useful for you to resolve Googlebot cannot access CSS and JS files error on your WordPress website. You may also check our WordPress Tutorials for Guidance on WordPress.