Blank <loc /> item

Submitted by esqare on Sat, 2007-12-08 04:16.

Hello,

I get like this error in sitemap page:

- <url>
  <loc>http://www.example.com/index.html</loc>
  </url>
- <url>
  <loc />
  </url>
- <url>
  <loc>http://www.example.com/index2.html</loc>
  </url>

But i can't see any address near the <loc /> item. How can i fix it?

Submitted by dmorison on Sat, 2007-12-08 05:49.

Hi,

This must have occurred because the tracking image was requested with no referrer. I've updated the distribution to check for this, so if you download the latest version this will no longer allow empty referrers into the database.

To remove the existing empty entry, if you have phpMyAdmin, the following SQL will remove the empty URL:

DELETE FROM urls WHERE url=''

Alternatively, you could run the following script from your /autositemap/ directory:

removeBlanks.php

<?php
  
require("config.php");
  
$link mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword);
  
mysql_select_db($config_databaseName,$link);
  
$sql "DELETE FROM urls WHERE url=''";
  
mysql_query($sql,$link);
?>

Cheers,
David.