0

Possible Duplicate:
How do I add PHP code to .html files?

is there a way to process php code on a .html/.htm file? the server supports php I just need the file to retain the .htm extension

Note: I really don't understand why some users feel the need to down vote on a valid question. Not all questions appear in the search unless it worded close to the previous question.

Thanks for all the answers below. AddType in the htaccess solved my problem

Community
  • 1
  • 1
acctman
  • 3,884
  • 27
  • 90
  • 133

4 Answers4

2

You can either use mod_rewrite, or add a directive to your .htaccess file to tell Apache (if that's what you're using) to add .htm as a PHP file type.

Martin Bean
  • 33,901
  • 20
  • 114
  • 183
  • 1
    You can throw stones at your sysadmin until he/she configures it, too. ;) So actually suggestion mod_rewrite for that is a bit over the top I'd say. Maybe not the first suggestion ;) – hakre Aug 24 '12 at 16:03
2

Add the following to your .htaccess:

AddHandler application/x-httpd-php5 .htm
WhoaItsAFactorial
  • 3,468
  • 4
  • 26
  • 44
0

You can change the file config of your web server (for example, in apache the httpd.conf file) to interprete the .htm as it was a php file.

Aurelio De Rosa
  • 20,508
  • 8
  • 45
  • 69
0

If you use Apache, look for the php addHandler directive in the apache2.conf file and add your extension in the list. Do not forget to restart apache after.

greg
  • 3,010
  • 20
  • 30