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!
Dan L
07-14-2008, 01:22 PM
In a .htaccess file,
ForceType application/x-httpd-php .html
smkied
07-14-2008, 01:55 PM
That's perfect, I'll try it out in a bit.
Thanks so much!
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:
[Sun Jul 20 21:15:57 2008] [alert] [client 68.---.---.--] /var/www/dev/test/.htaccess: ForceType takes one argument, a mime type that overrides other configured type
Not sure what to make of that. Suggestions?
vibrokatana
07-21-2008, 12:51 AM
I think it needs to be something like this:
<Files "afile.html">
ForceType application/x-httpd-php
</Files>
I don't touch .htaccess files much though.
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?
vibrokatana
07-21-2008, 12:56 AM
But there are 100's of files. I don't want to define each one individually. Can I just list the directory?
I am sure there is a wildcare that will work. But I don't know it :\
foobic
07-21-2008, 01:24 AM
Try AddType (http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addtype):
AddType application/x-httpd-php .html
If you need to use ForceType you can limit it to specified extensions within a Files or FilesMatch (http://httpd.apache.org/docs/2.2/mod/core.html#filesmatch) section.