How to add Header Content-type to static pages which doesn't have extensions?
I have a XML page www.example.com/page, but my server 开发者_如何学Gooutputs it as text/plain as it doesn't have any extension.
So I want to add XML Header via .htaccess to all the files which doesn't have extension with a condition that the file exists. As if file doesn't exist, program is executed from database and it decides what header to output, so I don't want to break that part by forcibly changing header.
Add a DefaultType text/xml
(or whatever type you're using for your XML) to your .htaccess
.
Other command you can put in your .htaccess (but it will force all files to have this content-type):
ForceType text/xml
http://httpd.apache.org/docs/1.3/mod/mod_mime.html#forcetype
精彩评论