How to Fix Googlebot Can not Access CSS and JS files WordPress
How to Troubleshoot Googlebot Cannot Access CSS and JS files WordPress - Do you see Googlebot unable to access CSS and JS files and there are "Googlebot Can not Access CSS and JS files" warnings in your webmaster tools on the WordPress site? The message also has links to instructions on how to fix this problem, but the instructions are still very confusing to resolve the issue. In this article, I'll show you how to fix a problem about Googlebot that can not access CSS and JS files on WordPress sites.
Google is focused on providing a better ranking for user friendly sites and sites that have fast loading speed, have a good user experience, etc. In order to determine the user experience of the website, Google needs access to be able to visit CSS and JavaScript files.
By default WordPress does not block bots searches from accessing any CSS or JS files. However some site owners may have inadvertently blocked those files while trying to add additional security measures or by using a security plugin to strengthen the WordPress site. This of course limits Googlebot to index CSS and JS files that can affect the performance of WordPress SEO.
Once we know the fact that it will be very important for us to open the file access so that googlebot can access it, now let's see how you can find these files and unblock them.
First you need to do is to find out which files Google can not access on your website. You can see how Googlebot sees your site by clicking Crawl >> Fetch As Google in Google Search Console (formerly Webmaster Tools). Next, click the fetch and render button to do so for both versions of Desktop and Mobile.
After the above steps you do, then the result will appear in the bottom row. Please click and it will show what users can see and what Googlebot can see when your site is loaded. If you see any difference between the two screenshots, then this means that Googlebot can not access the CSS / JS file. It will also show links from CSS and JS files that can not be accessed by google.
You can also find a list of blocked resources under the Google Indexs >> Blocked Resources menu.
Clicking on any displayed source will display links to actual resources that Googlebot can not access. Most will focus on CSS styles and JS files plus WordPress plugins or WordPress themes.
The next thing you need to do is to edit your site's robots.txt file, where the robots.txt file is the place to control all accessible file settings or blocked files. You can edit the robots.txt file by logging into your hosting control panel or by using FTP. The robots.txt file will be in the root directory of your site.
Find the robots.txt file on the WordPress site using an FTP client. If you use the SEO plugin by Yoast, then you can edit the robots.txt file from within your WordPress admin area. Simply go to the SEO page >> Tools and then click File Editor.
You most likely you will see in the robots.txt file have been disallowed access to some WordPress directories like this:
You should now remove the line of code that blocks Google access for CSS or JS files on your site's front-end. Usually these files are located in the plugin or folder theme. You may also need to remove Disallow: / wp-includes /, many WordPress themes and plugins can call scripts located in the wp-includes folder, such as jQuery.
Some users may notice that their robots.txt file is empty or does not even exist. If Googlebot does not find the robots.txt file, it can automatically access and index all of your WordPress files.
If you see your robots.txt file is empty but in webmaster tools there is still a "Googlebot Can not Access CSS and JS files" warning, it is most likely your hosting provider who is blocking access to the default WordPress folders. You can replace this in robots.txt so that googlebot can access to the blocked folder.
Once you're done, save your robots.txt file. Visit Google's fetch as settings again in your webmaster tools, and click the fetch and render button. And see the results, of course you will see the similarity between what visitors see and googlebot.
I hope this article helps you resolve the 'Googlebot can not access CSS and JS file' errors on your WordPress site. Good luck.
Why Google Needs Access to CSS and JS Files?
Google is focused on providing a better ranking for user friendly sites and sites that have fast loading speed, have a good user experience, etc. In order to determine the user experience of the website, Google needs access to be able to visit CSS and JavaScript files.
By default WordPress does not block bots searches from accessing any CSS or JS files. However some site owners may have inadvertently blocked those files while trying to add additional security measures or by using a security plugin to strengthen the WordPress site. This of course limits Googlebot to index CSS and JS files that can affect the performance of WordPress SEO.
Once we know the fact that it will be very important for us to open the file access so that googlebot can access it, now let's see how you can find these files and unblock them.
Then, How Can Google Access to CSS and JS Files?
First you need to do is to find out which files Google can not access on your website. You can see how Googlebot sees your site by clicking Crawl >> Fetch As Google in Google Search Console (formerly Webmaster Tools). Next, click the fetch and render button to do so for both versions of Desktop and Mobile.
After the above steps you do, then the result will appear in the bottom row. Please click and it will show what users can see and what Googlebot can see when your site is loaded. If you see any difference between the two screenshots, then this means that Googlebot can not access the CSS / JS file. It will also show links from CSS and JS files that can not be accessed by google.
You can also find a list of blocked resources under the Google Indexs >> Blocked Resources menu.
Clicking on any displayed source will display links to actual resources that Googlebot can not access. Most will focus on CSS styles and JS files plus WordPress plugins or WordPress themes.
The next thing you need to do is to edit your site's robots.txt file, where the robots.txt file is the place to control all accessible file settings or blocked files. You can edit the robots.txt file by logging into your hosting control panel or by using FTP. The robots.txt file will be in the root directory of your site.
Find the robots.txt file on the WordPress site using an FTP client. If you use the SEO plugin by Yoast, then you can edit the robots.txt file from within your WordPress admin area. Simply go to the SEO page >> Tools and then click File Editor.
You most likely you will see in the robots.txt file have been disallowed access to some WordPress directories like this:
User-agent: *
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/themes/
You should now remove the line of code that blocks Google access for CSS or JS files on your site's front-end. Usually these files are located in the plugin or folder theme. You may also need to remove Disallow: / wp-includes /, many WordPress themes and plugins can call scripts located in the wp-includes folder, such as jQuery.
Some users may notice that their robots.txt file is empty or does not even exist. If Googlebot does not find the robots.txt file, it can automatically access and index all of your WordPress files.
If you see your robots.txt file is empty but in webmaster tools there is still a "Googlebot Can not Access CSS and JS files" warning, it is most likely your hosting provider who is blocking access to the default WordPress folders. You can replace this in robots.txt so that googlebot can access to the blocked folder.
User-agent: *
Allow: /wp-includes/js/
Once you're done, save your robots.txt file. Visit Google's fetch as settings again in your webmaster tools, and click the fetch and render button. And see the results, of course you will see the similarity between what visitors see and googlebot.
I hope this article helps you resolve the 'Googlebot can not access CSS and JS file' errors on your WordPress site. Good luck.
Post a Comment for "How to Fix Googlebot Can not Access CSS and JS files WordPress"
Provide comments relevant to the posted articles and provide critiques and suggestions for the progress of the blog