View Full Version : php embedded in .htm pages

10-23-2005, 06:08 AM
I can get my PHP scripts running when they are in .php files.

Is it possible to embed php scripts in .htm files?

10-23-2005, 05:10 PM
If you are running Apache and can use .htaccess, your in luck. Create a new .htaccess file and then in the file save the following:

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html then you sould be able to embed php in a .html/.htm file.

10-23-2005, 07:41 PM
Thanks for that.

I'll give it a shot

10-24-2005, 02:19 PM
Why do you want to do this?

10-24-2005, 06:45 PM
So I won't have to change the names of all my pages and laa the links hrefs.

12-05-2007, 05:18 PM
I registerd in this forum to thank you
perfect answer:)

12-05-2007, 05:43 PM
It makes sense that you would want this, but--

1. You could run a PHP script to rename all .htm files to .php if you'd like.
(Loop through all directories and rename any *.htm to *.php.)

2. If you do override the .htaccess like that, you'll make your server work a bit harder making EVERY .htm file run through the PHP parser when they don't all need to.

Anyway, it's a valid option if these aren't too discouraging.