Surely you have received in your email an email from Google Webmaster Tools now called Google Search Console which warns you that " Google's robot can not access the CSS and JS files of http://tusitio.es ", and of course, the scare is morrocotudo, not to mention if you have several sites and you have received a few messages of these, right? And you will receive them.
Well, everything has its explanation, and especially solution.
Why Google cares about CSS and JS files?
It is well known by all that what really matters about a web is the content, then what is this sudden interest of Google for the CSS and JS files?
It's more does it sound like the importance of offering your website adapted to mobile? ] So that.
Why Google can not access CSS and JS files?
Simple, blame yours surely . Let me explain …
Historically, the recommended rules for file robots.txt the one that tells Google what to crawl and what not, included blocking internal WordPress folders , those that do not have content but are useful for the CMS. Logically I am referring to wp-admin and wp-includes .
In this way, the robots.txt typical and basic file of a WordPress installation is usually be a thing like this:
User – agent : *
Disallow : / wp – admin /
Disallow : / wp – includes /
Disallow :  / xmlrpc . php
In the notices that have been received since yesterday most of the errors are from JS since it is not so usual to block CSS files, but h And to review everything.
What's more, you should not only check the websites on which you have received notices but on all you have, for avoid Google tracking errors .
How do I get Google to access the CSS and JS files?
The first thing is to ignore the Google email (more or less) and go through the Google Search Console to perform These 3 steps:
- Review the blocked resources
- Modify the robots.txt file so that it stops blocking them
- Explore, process and validate your website from the section " Explore as Google " Search Console
1. Review blocked resources
Manage the affected website – or not – and visit the section called Google Index -> Blocked Resources . There you will see a chart and a list of blocked pages.
In the list you will see a little bit of everything, but you should focus on the URLs that point directly to your website and click on that line to check which pages are blocked from your site.
You only have to click on any of them for Google to show you what actions you should take, and in this case, of the 3 options it offers you, you should go directly to the third one, to Tester robots.txt to check what you are blocking.
In the tool, located in the menu Crawl -> robots.txt Tester of the Google Search Console, you will see your current file robots. txt and conveniently marked in red or yellow errors and warning s. In this case it is normal to find a very fat red error pointing to the folder / wp-includes / which you already know is from WordPress.
How do I unlock pages with errors? Well, let's go to the second step …
2. Modify the robots.txt file so that it stops blocking them
To remove the locks obviously we have to modify the file robots.txt and we have several ways to do it
2.1 Modify the robots.txt file manually
If you are not afraid to modify files on your server simply access from your hosting panel or via FTP and manually edit the file robots.txt that you will find in the root folder of your site. Simply delete the line that blocks the CSS and JS, normally that says:
Save the changes and that's it.
2.2 Modify the robots.txt file with plugins
If you prefer to use plugins you can help with a couple from them. On the one hand there is a specialized one called WP Robots.txt that simply adds an editor of this file so that you add or remove rules to your liking. I think there's no need to tell you what you have to remove, right?
You save the changes and drive.
The other possibility, which is which you will almost certainly use, is to use the SEO plugin file editor tool such as All in one SEO Pack or Yoast SEO which you will probably have already installed. In this case the process is as follows:
Modify robots.txt with All in one SEO Pack:
- Active modules of Robots.txt and File Editor from the menu Feature manager if they were not already.
- You access the File editor and delete the line that is causing the errors and save the changes.
Modify robots.txt with Yoast SEO:
- You go to Tools -> File editor
- If you do not already have a file created, or Yoast does not detect it, you give the button to create it
- Modify the file by deleting what is blocking Google and save the changes
It's really easy. Then just check that your file robots.txt has been saved correctly by accessing http://tusitio.es/robots.txt .
3. Explore, process and validate your website from the section " Explore as Google " of the Search Console
Once all of the above is done, all that remains is to validate your website, but first it is worth checking that Google no longer shows errors related to the file robots.txt .
To do this we will go back to the Google Search Console and go through the section Crawl -> robots.txt Tester to see if the new file is displayed and there are no errors. It may take a while, so do not panic if you do not see the new one on your first login.
When we already have the certainty of that there are no errors we go to the final cited step of Explore as Google to process and validate our website.
The page in question is in Crawl -> Explore as Google and the process is as follows:
- Press the button Get (or the one of Get and process ) for Google to explore our website. We must do this for each of the options in the drop-down that is just before the enormous red Get button, which are:
- Mobile: smartphone
- Googlebot-Mobile: XHTML-WML
- Googlebot- Mobile: cHTML
- We wait a few seconds for the process to be performed in the lower list and press the button that will appear called Send to the index .
You must bear in mind that Google Search Console allows you only 10 posts per month to the index so do not be thrilled with this tool.
Nothing more, nothing less . With these simple steps Google will be able to correctly track your website. Of course, as I said before, do not wait to receive an email from Google to do the verification.
What do not you still use the Google Search Console? Well, you're already late . Not only allows you to check and improve the SEO of your website but it warns you of these errors and many others, some even related to WordPress .
Hala, share this so that others also know how to do it and it buzzes to the Google Search Console .