Excluding external urls from the sitemap

I've improved your code in sitemap_xml.php inserting the following code underneath the unset() statement:

$pos = 0;
foreach($nav as $n) {
if ( count($n) > 1 ) {
if ( strpos( $n['location'], 'http') > -1 ) {
unset($nav[$pos]);
}
}
$pos++;
}

Stops external urls reaching the xml.

Sign In or Register to comment.