{"id":1631,"date":"2016-10-02T08:22:12","date_gmt":"2016-10-02T12:22:12","guid":{"rendered":"https:\/\/www.gsqi.com\/marketing-blog\/?p=1631"},"modified":"2016-10-03T09:14:42","modified_gmt":"2016-10-03T13:14:42","slug":"utf-8-bom-robots-txt","status":"publish","type":"post","link":"https:\/\/www.gsqi.com\/marketing-blog\/utf-8-bom-robots-txt\/","title":{"rendered":"UTF-8 BOM and SEO: How to find, clean, and fix an invisible character in your robots.txt file"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.gsqi.com\/images\/utf-bom-seo.jpg\" alt=\"UTF-8 BOM and SEO\" width=\"650\" height=\"440\" \/><\/p>\n<p>I\u2019ve written in the past about how a robots.txt file could look fine, but actually not be fine. For example, maybe you add your directives, a sitemap file or sitemap index file, and then upload it to your site. You think all is good, but you find that directives are not being adhered to, maybe a boatload of urls that are being crawled that shouldn\u2019t be, etc. When that happens, it can have a big impact on SEO (especially on large-scale sites with many urls that should never be crawled).<\/p>\n<p>So why does this sinister robots.txt problem happen? It often comes to down a single character. Literally. Sure, it\u2019s an invisible character, but a character nonetheless. It\u2019s called the UTF-8 BOM and I\u2019m going to explain more about that in this post. Unfortunately, I\u2019ve come across this issue many times during audits and while helping companies with technical SEO. It\u2019s sinister, since it\u2019s invisible. But the results are extremely visible (and can be alarming).<\/p>\n<p>Below, I\u2019ll cover what UTF-8 BOM is, how it can impact your robots.txt file, how to check for it, and then how to fix the problem. So, if your robots.txt file is bombing, and you are still scratching your head wondering what\u2019s going on, then this post is for you.<\/p>\n<p><strong>What is UTF-8 BOM?<br \/>\n<\/strong>BOM stands for byte order mark and it\u2019s used to indicate the byte order for a text stream. It\u2019s an invisible character that\u2019s located at the start of a file (and it\u2019s essentially meaningless from an SEO perspective). Some programs will add the BOM to a text file, which again, can remain invisible to the person creating the text file. And the BOM can cause serious problems when Google tries to read the file. Actually, the UTF-8 BOM can make your robots.txt file, well, <strong>bomb<\/strong>&#8230; Sorry for the play on words here, but I couldn\u2019t resist. :)<\/p>\n<p><strong>What can happen to a\u00a0robots.txt file when UTF-8 BOM is present?<br \/>\n<\/strong>As mentioned above, when your robots.txt file contains the UTF-8 BOM, Google\u00a0can choke on the file. And that means the first line (often user-agent), will be ignored. And when there\u2019s no user-agent, all the other lines will return as errors (all of your directives). And when they are seen as errors, Google will ignore them. And if you\u2019re trying to disallow key areas of your site, then that could end up as a huge SEO problem.<\/p>\n<p>For example, here\u2019s what a robots.txt file looks like in GSC when it contains UTF-8 BOM:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.gsqi.com\/images\/utf-bom-robots-txt-gsc.jpg\" alt=\"UTF8-BOM in robots.txt Tester in GSC\" width=\"546\" height=\"488\" \/><\/p>\n<p>Needless to say, all of the directories that should be disallowed are not being disallowed. And that means many urls that shouldn\u2019t be crawled are being crawled (and many are being indexed). This can lead to all sorts of nasty SEO problems. And that could include quality problems, as well, depending on what is being crawled and indexed.<\/p>\n<p><strong>How to identify UTF-8 BOM:<br \/>\n<\/strong>Right now, you might be sweating a little. Maybe you\u2019ve seen problems with your robots.txt file and subsequent indexation, and you\u2019re now wondering if UTF-8 BOM is the problem. Don\u2019t worry, I\u2019ll quickly walk you through how to check your robots.txt file now.<\/p>\n<p>1. First, fire up GSC and use the robots.txt Tester. When you view the report, does it look like the screenshot above? Is the first line showing a red X next to it? If so, hover over the x and you might see a hint that says, \u201cSyntax not understood\u201d. If so, there\u2019s a good chance you\u2019ve got the UTF-8 BOM situation I\u2019ve been explaining.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.gsqi.com\/images\/utf-bom-gsc-syntax.jpg\" alt=\"Syntax error when testing robots.txt file in GSC\" width=\"517\" height=\"270\" \/><\/p>\n<p>2. Next, visit the <a href=\"http:\/\/validator.w3.org\/i18n-checker\/#validate-by-upload+\">W3C Internalization Checker<\/a>. This tool will enable you to upload your robots.txt file and check for the presence of UTF-8 BOM.<\/p>\n<p>3. Next, click the tab labeled \u201cBy File Upload\u201d:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.gsqi.com\/images\/utf-bom-w3c-checker.jpg\" alt=\"How to check robots.txt using W3C checker\" width=\"650\" height=\"260\" \/><\/p>\n<p>4. Next, click \u201cChoose File\u201d and select your robots.txt file. Then click the \u201cCheck\u201d button:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.gsqi.com\/images\/utf-bom-w3c-checker-all.jpg\" alt=\"Choosing a robots.txt file to check for UTF-8 BOM\" width=\"650\" height=\"260\" \/><\/p>\n<p>The tool will return the results, which will include a line about UTF-8 BOM. If you see that in the results, you know what the problem is (which is great). That\u2019s the smoking gun.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.gsqi.com\/images\/utf-bom-result-top.jpg\" alt=\"W3C Checker Results for UTF-8 BOM\" width=\"567\" height=\"493\" \/><\/p>\n<p><strong>How to fix UTF-8 BOM in your robots.txt file:<br \/>\n<\/strong>Fixing the issue is pretty easy. I recommend using a text editor like <a href=\"https:\/\/www.textpad.com\/\">Textpad<\/a> to create your new robots.txt file. When saving the file, ensure that BOM is not selected (some text editor programs have an option for adding the BOM).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.gsqi.com\/images\/utf-bom-text-editor-option.jpg\" alt=\"Checking for UTF-8 BOM in text editor\" width=\"650\" height=\"110\" \/><\/p>\n<p>Also, make sure you\u2019re not using a word processing application like Microsoft Word for creating your robots.txt file. I\u2019ve seen that cause problems too. You should be using a pure text editor for creating your robots.txt file, .htaccess file, xml sitemaps, etc. I\u2019m a big <a href=\"https:\/\/www.textpad.com\/\">Textpad<\/a> fan, but there are many others you can use as well.<\/p>\n<p>Once you make the changes, then use the <a href=\"http:\/\/validator.w3.org\/i18n-checker\/#validate-by-upload+\">W3C internationalization tool<\/a> to check the revised file. If the BOM doesn\u2019t show up, you\u2019re good to go. If it is, you are doing something wrong while creating the robots.txt file. Go back and start over using a pure text editor.<\/p>\n<p>After you\u2019ve fixed the problem, head back to GSC and to the robots.txt Tester. The tool enables you to submit a request to Google to retrieve your latest robots.txt file (after you upload the new one).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.gsqi.com\/images\/utf-bom-gsc-submit.jpg\" alt=\"Submitting a new robots.txt file to GSC\" width=\"590\" height=\"445\" \/><\/p>\n<p>If you\u2019ve done everything correctly, the errors should be removed from the robots.txt Tester and your directives will now work (blocking directories and files that should not be crawled).<\/p>\n<p><strong>Side note: Blocking does not mean \u201cremove from index\u201d (usually):<br \/>\n<\/strong>If you\u2019ve been experiencing robots.txt issues due to the UTF-8 BOM problem I\u2019ve covered here, your work might not be done. If many pages have been indexed, then just blocking via robots.txt will not remove those pages from the index. Over time, <a href=\"http:\/\/searchengineland.com\/robots-txt-file-case-study-third-party-directive-changes-led-leaking-urls-lost-seo-traffic-238334\">Google can remove them<\/a>, but I would try and get those undesirable urls out of Google\u2019s index quickly.<\/p>\n<p>For example, you could add the meta robots tag using \u201cnoindex\u201d and submit an xml sitemap to Google that contains all of the urls that you want deindexed. Then once you\u2019re sure those urls are deindexed, you could block those directories again via robots.txt. But remember, if you add noindex to files that are being blocked via robots.txt, then Google will <strong>never be able to see<\/strong> the meta robots tag\u2026 You will need to let Google recrawl those pages first, see the meta robots tag using noindex, and then you can start blocking the files again. That\u2019s a confusing subject for many in SEO, but it\u2019s a really important one.<\/p>\n<p><strong>Summary \u2013 Don\u2019t Let UTF-8 BOM Turn Into An SEO Bomb<br \/>\n<\/strong>There are several hidden and sinister problems that can rear their ugly heads in SEO. The UTF-8 BOM is one of them. If your robots.txt file is not working as expected, throwing errors, and causing serious headaches, then follow the instructions in this post to test for UTF-8 BOM. You might find that a hidden character is the gremlin causing major SEO problems. Then it\u2019s up to you to remove that problem by \u201cdisarming the BOM\u201d. :)<\/p>\n<p>GG<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve written in the past about how a robots.txt file could look fine, but actually not be fine. For example, maybe you add your directives, a sitemap file or sitemap index file, and then upload it to your site. You think all is good, but you find that directives are not being adhered to, maybe &#8230; <a title=\"UTF-8 BOM and SEO: How to find, clean, and fix an invisible character in your robots.txt file\" class=\"read-more\" href=\"https:\/\/www.gsqi.com\/marketing-blog\/utf-8-bom-robots-txt\/\" aria-label=\"Read more about UTF-8 BOM and SEO: How to find, clean, and fix an invisible character in your robots.txt file\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[],"class_list":["post-1631","post","type-post","status-publish","format-standard","hentry","category-google","category-seo","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/posts\/1631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/comments?post=1631"}],"version-history":[{"count":8,"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/posts\/1631\/revisions"}],"predecessor-version":[{"id":1637,"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/posts\/1631\/revisions\/1637"}],"wp:attachment":[{"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/media?parent=1631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/categories?post=1631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gsqi.com\/marketing-blog\/wp-json\/wp\/v2\/tags?post=1631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}