error on line 5 at column 6: XML declaration allowed only at the start of the do

#571933
  • Resolved Anonymous
    Rank Math free

    Hi,

    I got this error when I visit https://sagittarius-one.com/?sitemap=1 or https://sagittarius-one.com/sitemap_index.xml. I tried every item of this artikel but unfortunately with no succes.

    I think it’s because of the white space in the code. This is the code in the source code:

    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//sagittarius-one.com/main-sitemap.xsl"?>
    <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
    <loc>https://sagittarius-one.com/post-sitemap.xml</loc>
    <lastmod>2022-11-30T15:29:38+00:00</lastmod>
    </sitemap>
    <sitemap>
    <loc>https://sagittarius-one.com/page-sitemap.xml</loc>
    <lastmod>2023-05-10T12:49:58+00:00</lastmod>
    </sitemap>
    <sitemap>
    <loc>https://sagittarius-one.com/product-sitemap.xml</loc>
    <lastmod>2023-05-10T12:02:14+00:00</lastmod>
    </sitemap>
    <sitemap>
    <loc>https://sagittarius-one.com/category-sitemap.xml</loc>
    <lastmod>2022-11-30T15:29:38+00:00</lastmod>
    </sitemap>
    <sitemap>
    <loc>https://sagittarius-one.com/product_cat-sitemap.xml</loc>
    <lastmod>2023-05-10T12:02:14+00:00</lastmod>
    </sitemap>
    </sitemapindex>
    <!-- XML Sitemap generated by Rank Math SEO Plugin (c) Rank Math - rankmath.com -->

    A lot of white rules before the code starts. How do I remove this rules (putting code in my functions.php didn’t work). Or which other way can I fix this error?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello,

    Thank you for contacting the support and sorry for any inconvenience that might have been caused due to that.

    As you have already followed all the steps mentioned in this article : https://rankmath.com/kb/fix-sitemap-issues/. This issue is normally caused due to conflict between plugin or theme.

    Would you please confirm if you ran this troubleshooting guide: https://rankmath.com/kb/check-plugin-conflicts/

    Looking forward to helping you.

    Anonymous
    Rank Math free

    Hi Sandeepan Kumar,

    Thank you for reply.

    Yes I also did that with de healht plugin. When I set the website in troubleshoot mode the error still display.

    Is there an option to remove the white space in the sitemap? I think that’s the problem and that will maybe the reason the error shows even the website is in troubleshoot mode.

    Hello,

    There is no whitespace directly added to Rank Math’s sitemap as they are dynamically created. Those whitespaces are being added there if there are blank spaces in your wp-config.php file or your theme’s functions.php file.

    You can get in touch with your web host to check those files for any white/blank spaces to ensure they are not affecting the sitemap generation.

    Let us know how this goes.

    Thank you.

    Anonymous
    Rank Math free

    Hi Reinelle,

    Thank you for your reply.

    I read that but what do you mean by ‘Those whitespaces are being added there if there are blank spaces in your wp-config.php file or your theme’s functions.php file.’

    What should be in my functions.php or wp-config.php that creates this white space?

    Hello,

    Those white or blank spaces are literally empty lines in your file like in this screenshot (notice the first few lines)

    whitespace

    You may also check with your theme provider if there are any white spaces in their functions.php file.

    Hope that helps.

    Thank you.

    Anonymous
    Rank Math free

    Hi Reinelle,

    Thank you for explaining. That’s not the problem I checked both files and both doesn’t begin with empty lines.

    Which other problem could it be?

    Hello,

    In this case, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    Looking forward to helping you.

    Thank you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    I ran the troubleshooting of the website. As soon as I activate Astra Child theme, the error shows.

    I would suggest please look into the Astra child theme for the issue with the sitemap.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)

The ticket ‘error on line 5 at column 6: XML declaration allowed only at the start of the do’ is closed to new replies.