Knowledgebase

PHP, HTML and MIME Types

Posted by smkied, 07-14-2008, 01:15 PM
Hello! My problem is quite simple, and I am hoping it goes the same for the solution. Basically, I just need files with the extension .htm and .html to behave like .php files. That is, any PHP code within such files needs to be read as PHP code. From my understanding, this can be done with MIME Type settings in Apache. How exactly would I go about it? What is the code that I would have to use? I appreciate all your help!

Posted by Dan L, 07-14-2008, 01:22 PM
In a .htaccess file, ForceType application/x-httpd-php .html

Posted by smkied, 07-14-2008, 01:55 PM
That's perfect, I'll try it out in a bit. Thanks so much!

Posted by smkied, 07-21-2008, 12:19 AM
So I tried this out and it's not working. I get an internal server error, and here is what the error log states: Not sure what to make of that. Suggestions?

Posted by vibrokatana, 07-21-2008, 12:51 AM
I think it needs to be something like this: ForceType application/x-httpd-php I don't touch .htaccess files much though.

Posted by smkied, 07-21-2008, 12:55 AM
But there are 100's of files. I don't want to define each one individually. Can I just list the directory?

Posted by vibrokatana, 07-21-2008, 12:56 AM
I am sure there is a wildcare that will work. But I don't know it :\

Posted by foobic, 07-21-2008, 01:24 AM
Try AddType: If you need to use ForceType you can limit it to specified extensions within a Files or FilesMatch section.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
Android Aplications (Views: 617)
ev1 speed issues??? (Views: 655)
Looking For Script (Views: 597)


Language:

Client Login

Email

Password

Remember Me

Search