tags:

views:

380

answers:

1

Hello, I needed to add a crossdomain.xml file to my website so that an embeddable flash widget can access its rss feed. The widget is throwing an error, and it looks like it's because my crossdomain.xml file isn't being seen as a valid xml file.

In noticed that if you browse to the crossdomain file on my site the browser opens the download dialog: http://imgfave.com/crossdomain.xml

Whereas if you go to the crossdomain file on another site, the browser opens the file: http://newfoundlandartstore.com/crossdomain.xml

Maybe my server isn't including the proper headers for xml file? Is there anyway to have a php crossdomain file and set the headers in PHP?

A: 

At the top, put:

<?php
  header('Content-Type: text/xml');
?>

To make the webserver run the .xml as a .php file, add this to .htaccess:

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

However, you can just avoid the PHP and simply write:

AddType text/xml .xml
Ben Alpert
But it's not going to execute that code since it's not a PHP file. Is there a way, maybe in htaccess, to tell it to execute just that specific file as PHP?
makeee
Yup. There you go.
Ben Alpert