-
mime types
This should be a straight forward problem but it is driving me mad trying to get it to work!
What im trying to do:
I have a file - index.html which contains php code but i want it to appear to be a html file. Straight forward enough.
There for in .htaccess i have put in the following code
AddType application/x-httpd-php .html
which should map the html file on the php application, right?
However all i get is a 500 internal server error.
The file in question runs fine with a .php extension.
Help!
-
AddType directive works only with PHP compiled as Apache module. Since we are running PHPSuExec on our servers you will need to use AddHandler directive to get php code working in .html files :
AddHandler application/x-httpd-php .html
-
Excellent, All sorted.
Thank you!
-
Just a side note that on the newer (and soon to be deprecated) Apache builds where you have the option to select php4 or php5 you will want to modify the above suggestion to this:
AddHandler application/x-httpd-php5 .html .htm .php
or
AddHandler application/x-httpd-php4 .html .htm .php
Depending on the version of php that you are running. You can configure this in your cPanel > PHP Configuration.
Remember PHP4 will soon be dead so we recommend selecting PHP5.