phpmlx Posted February 19, 2008 Share Posted February 19, 2008 I run Apache 2.2 and PHP 5.2.5 on Windows. I have started using PHP to generate dynamic css and images. In Apache I have added the line AddType application/x-httpd-php .css In PHP I have set default_mimetype=""; This now works fine. However, (and obviously), no content type is sent for any PHP processed file (css, php etc). This is generally not a problem, but I would like to be able to set a default so that ALL ".css" automatically get mimetype=text/css and all ".php" get mimetype=text/html unless specified otherwise. In otherwords, is it possible to make the default_mimetype configuration extension sensitive? (I am aware of the header("Content-Type:") php function but do not want to specify mime-types in each file.... Any help / guidance appreciated! Chrs, Alan Link to comment https://forums.phpfreaks.com/topic/91857-default-mime-type/ Share on other sites More sharing options...
redarrow Posted February 19, 2008 Share Posted February 19, 2008 you need to use templates first you create your header info then add it to the index page with a include("header.php"); with the header page you add your mime types................. you also add your css to the header/index page.......... Link to comment https://forums.phpfreaks.com/topic/91857-default-mime-type/#findComment-470416 Share on other sites More sharing options...
phpmlx Posted February 19, 2008 Author Share Posted February 19, 2008 Thank you for the suggestion. I assume by templates you're suggesting building the website using templates. That is fine (and what I do anyway) but not how I want to go ahead with this! I was wondering if PHP has any method to automatically detect and send the correct default_mimetype? Similar to Apache's AddType configuration (which was the only way I could determine of processing CSS extension files with PHP). Hope this is possible! Alan Link to comment https://forums.phpfreaks.com/topic/91857-default-mime-type/#findComment-470431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.