MIME Types, PHP, and XML

I have a PHP file that dynamically creates an RSS/XML feed. It worls fine, but some readers want to see a “.xml” extension on the feed file rather than a “.php” extension.

What is the reight way to set up the .htaccess file so that the .xml file is run through the PHP interpreter but is still output with a MIME type of XML.

I know that I could use header redirection, but that doesn’t work in my app for another reason too long to explain.

Try this:

RemoveHandler .xml
AddType application/x-httpd-php .xml

That should add the xml extension to run through the interpreter.
Not tested: Use at your own risk.

Thanks, that seems to work! Can you explain what those magic lines did?