You are here:  » sitemap error


sitemap error

Submitted by paullas on Tue, 2020-12-01 12:17 in

Hi David

When i go to example.com/sitemap.php i get this error:

XML Parsing Error: XML or text declaration not at start of entity
Location: https://www.example.com/sitemap.php
Line Number 2, Column 1:

I have tried to submit the sitemap to google console and it says discovered urls is 0

any ideas how i fix this.

thanks

paul

Submitted by support on Tue, 2020-12-01 12:29

Hi Paul,

That sounds like the same issue you had on another site where white space had crept into your sitemap.php causing a blank line at the start of the output - if you edit the file and check that there is nothing outside of the opening and closing PHP tags that should be all it is;

Bear with me on your other posts regarding parking / multiple domains pointing to sub-sections of a different installation I'll work out the best approach and post those shortly...

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Tue, 2020-12-01 17:43

Hi David

This what i have in my sitemap.php

<?php
  require("includes/common.php");
  header("Content-Type: text/xml");
  {code saved}
?>

Submitted by support on Wed, 2020-12-02 08:29

Hi Paul,

The PHP section is self contained but what is important is nothing before the opening <?php tag or after the closing ?> tag but it looks like that may be the case so the other possibility is that your text editor may have added "Byte Order Markers" (BOM) at the top of the file. To check if this is the case, open the file in your text editor, make and undo a change and then use File > Save As and on the dialog look for character encoding drop down and you may find an option something like "UTF-8 No BOM". Alternatively, it might be a menu function whilst editing, in which case select do disable BOM, make and edit and then re-save the file...

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Wed, 2020-12-02 10:18

Hi David

Tried the below in notepad++

{link saved}

still getting the error.

thanks

Paul

Submitted by support on Wed, 2020-12-02 11:27

Hi Paul,

When I wget the file I'm still seeing a new-line before the opening <?php tag, if you'd like to email me your sitemap.php (as I believe it has been modified from the distribution) I'll check it out for you...

Cheers,
David.
--
PriceTapestry.com