Jump to content

Default MIME-Type


phpmlx

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.