Error on line 2 Sitemap

#774836
  • Mars_
    Rank Math free

    This page contains the following errors:
    error on line 2 at column 6: XML declaration allowed only at the start of the document
    Below is a rendering of the page up to the first error.

    Is the error we receive on our sitemap, which rank math generates.

    Caching has been turned off for the sitemap in both LiteSpeed & htaccess.

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

    I’m sorry to hear about the error you are experiencing with your Rank Math-generated sitemap. The error message “error on line 2 at column 6: XML declaration allowed only at the start of the document” typically indicates that there might be some whitespace or characters before the XML declaration in the sitemap file.

    To address this issue, you can follow these steps:

    1. Check for Whitespace: Ensure there are no blank spaces or lines before the XML declaration in your sitemap file. This whitespace can sometimes cause parsing issues.

    2. Exclude Sitemap from Caching: Since you have already turned off caching for the sitemap in LiteSpeed and htaccess, you may also need to check if there are any other caching mechanisms in place that could be affecting the sitemap.

    If the issue persists after checking for whitespace and excluding sitemaps from caching, please let us know so we can further assist you. Thank you for bringing this to our attention.

    Sources:
    Rank Math Sitemap Issues and Their Fixes » Rank Math
    How To Exclude Rank Math Sitemaps from Caching » Rank Math

    This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.

    Hello,

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

    This sitemap error indicates that there must be some white space before the XML Sitemap’s source code. You can also look at the source code of Sitemap and see if there is any extra line or space before the XML. This is caused by a blank line or space in your wp-config.php or functions.php file.

    Please follow this troubleshooting guide to fix that issue:
    https://rankmath.com/kb/fix-sitemap-issues/#xml-text-declaration

    Let us know how it goes. Looking forward to helping you.

    Thank you.

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

You must be logged in to reply to this ticket.