Thread tagged as: Problem

XML Sitemap Not Parsing

I've set up an XML sitemap using this navigation template (replacing example URL with my own):

<perch:before><?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="">
    <loc><perch:pages id="pagePath" /></loc>

And a file in the root of the website called 'sitemap.xml' which contains this (my Perch directory is the default '/perch'):

    header('Content-type: application/xml');
        'template' => 'sitemap.html',
        'flat' => true,
        'hide-extensions' => true

I've then added this line to my .htaccess file to parse the XML as PHP:

AddType application/x-httpd-php .php .htm .html .xml

Now, I can't view the XML file (it just downloads a copy when I browse to the file) and the Google Sitemap test is throwing this error: "Your Sitemap appears to be an HTML page. Please use a supported sitemap format instead."

Perch doesn't appear to be doing anything to the file - is this pointing to a problem in my .htaccess file?

My hosting is with Media Temple which uses the same MIME Type and as far as I can see, it should be working.

Philip Gwynne

Philip Gwynne 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

When it downloads, do you get the raw PHP or the parsed XML?

Just the raw PHP.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You'll want to check this with your host:

AddType application/x-httpd-php .php .htm .html .xml

Thanks Drew. Apparently, Media Temple require an extra step adding the following above it:

AddHandler php-stable .php .htm .html .xml
AddType application/x-httpd-php .php .htm .html .xml

This has been driving me nuts for ages, need to check with my host on this one.