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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.