How to Fix “The Page May Not Render Properly Due to Resources Blocked” Error
- Category : WordPress
- Posted on : Dec 23, 2018
- Views : 1,863
- By : Radcliff S.
Working with WordPress on a 24×7 basis the team here at Host SEO sees all sorts of different errors and warnings that clients experience. Trust us, we’ve pretty much seen it all. Whenever an error keeps popping up in our system we make sure to document it so that we can share the solution with you. What good is a premium host that doesn’t help you resolve your own issues? Today we’ll be diving into a Google Search Console error you may or may not have encountered: “The page may not render properly due to resources blocked by robots.txt.”
Don’t worry, we’ll explain what this means and how to go about fixing it on your WordPress site.
Blocked Resources
If you get a warning or error about blocked resources it typically means something is not configured correctly on your WordPress site. This is not always the case, but if you’re seeing a message about anything in Google Search Console you should always investigate it. Google provides these messages for a reason. Our recent experience with an unwarranted Google penalty definitely proves this point.
If you didn’t get a message about blocked resources you can always check your site by logging into Google Search Console. Then click on Google Index → Blocked Resources. As they state:
Googlebot needs access to many resources on your page in order to render and index the page optimally. For example, JavaScript, CSS, and image files should be available to Googlebot so that it can see pages like an average user.
These resources from this host are used by your site, but blocked to Googlebot. If Googlebot can’t access important resources on your page, the page might be indexed incorrectly. (Source: Blocked Resources Report)
Again, just because a resource is blocked doesn’t always mean it’s harming your site’s SEO. But its best practice to clean these up so when those that do impact your SEO come along you can more easily fix them without having to filter through pages of errors.
We love sharing live data with you. So in today’s example, we have an issue with multiple (400+) blocked resource errors happening (as seen below) on our own site.
When you see errors in the blocked resources section you can click on them for additional details. So we click on https://CentrioHost.com/wp-admin/admin-ajax.php
. The admin-ajax.php
file is just one example of something that may show up here. You might also see errors about JavaScript or CSS files being blocked. But fixing them generally involves the same steps.
On the page we see the following error: “The page may not render properly due to resources blocked by https://CentrioHost.com/robots.txt
.”
Their advice given is to update the robots.txt
rule to unblock the resource. If you’ve never heard of this file before, we suggest you first read our deep dive into the robots.txt file in WordPress.
You can use the Google Fetch tool to view the page as Google sees it. This can help you determine if the blocked resource is impacting the appearance of your page. Again, we simply recommend cleaning up all errors reported in here if possible.
We can see the resource it’s complaining about is https://CentrioHost.com/wp-admin/admin-ajax.php?action=essb_counts&...
In our case AJAX is being used by our WordPress social media plugin. If we input it into Robots Testing Tool we can see that Google indeed can’t find it. This is because the /wp-admin/
directory is in fact blocked, as we’ll dive into further below.
Yoast SEO has referenced this “blocked resources” issue in a blog post containing their example robots.txt file. Basically, AJAX (admin-ajax.php
) is used by some WordPress themes and plugins to add content to a page or perform a certain function. WordPress actually used to block this by default but it was fixed in WordPress 4.4. Google can now crawl admin-ajax.php
in wp-admin.
But how many of you were already running your WordPress site prior to version 4.4 coming out? Probably 99% of you. And like us, you probably have a custom robots.txt
file that was tweaked by you or a developer along the way which is overwriting the new default. This means the warnings would still show up in Google Search Console unless you fix them. The answer is to simply update your robots.txt file.
Updating Your Robots.txt File
WordPress by default creates a virtual robots.txt
file. However, we always recommend creating a physical one. Not sure if you already have one? Try browsing to the root of your WordPress site: https://domain.com/robots.txt
. If one exists, you’ll see it. If not, you’ll get a 404 error.
We are big fans of Yoast SEO here at Host SEO, we use it on our site, and it’s the #1 SEO plugin we recommend for your WordPress site. Many don’t know you can easily create and edit your robots.txt
right from your WordPress dashboard using it.
Click on SEO → Tools. Then click on “File editor.” This will not appear if you have file editing disabled. If you want to keep this disabled you can create/edit your robots.txt
file via SFTP.
If you don’t have a physical file you can click on “Create robots.txt
file.” This creates a physical file on your server.
If you already have a robots.txt
file, it might look like this (Or it might be really long! We have seen some crazy robots.txt files):
User-agent: * Disallow: /wp-admin/
There is another line we need to add to fix the blocked resources error. So in our example, we add the following line (this is the now the default robots.txt
configuration when you create a file using Yoast and WordPress on a fresh install):
User-agent: * Disallow: /wp-admin/ Allow: /wp-admin/admin-ajax.php
This allows Google to now crawl it.
In regards to the admin-ajax.php
file itself, you don’t have to worry about it accidentally showing up in Google or indexing because if you look at the file, it actually contains the following noindex header.
@header( 'X-Robots-Tag: noindex' ); If you’re seeing other types of resources blocked errors, such as JavaScript or CSS, a quick way to fix them is to revert back to the standardrobots.txt
configuration above. Thewp-content/plugins/
and/wp-includes/
are common directories we’ve seen users block by mistake which in turn sometimes causes these types of issues. You can see below after allowing the above file in ourrobots.txt
file our blocked resources errors resolved within a few days in Google Search Console.
Summary
Fixing errors and warnings in Google Search Console is an important part of properly maintaining your WordPress site. This helps to ensure that Google sees your site properly and indexes it. Hopefully the next time you encounter blocked resource errors, you’ll know how to better troubleshoot it!
Have any thoughts regarding blocked resources? Have you seen this on your own sites?
Categories
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Recent Articles
-
Posted on : Jul 25
-
Posted on : Jul 07
-
Posted on : Apr 07
-
Posted on : Mar 19
Optimized my.cnf configuration for MySQL 8 (on cPanel/WHM servers)
Tags
- layer 7
- tweak
- kill
- process
- sql
- Knowledge
- vpn
- seo vpn
- wireguard
- webmail
- ddos mitigation
- attack
- ddos
- DMARC
- server load
- Development
- nginx
- php-fpm
- cheap vpn
- Hosting Security
- xampp
- Plesk
- cpulimit
- VPS Hosting
- smtp
- smtp relay
- exim
- Comparison
- cpu
- WHM
- mariadb
- encryption
- sysstat
- optimize
- Link Building
- apache
- centos
- Small Business
- VPS
- Error
- SSD Hosting
- Networking
- optimization
- DNS
- mysql
- ubuntu
- Linux