Jump to content

Change .php to .htm ?


ShaolinF

Recommended Posts

Yup there is a way. You can change the settings of your server to be able to parse php within html pages. That is what I remember reading once in a php book. - I'm not exactly sure. Why would you want to change php --> htm anyway?

 

@TheFilmGod - this may be hard to believe - but the link I posted explains.

Link to comment
https://forums.phpfreaks.com/topic/62328-change-php-to-htm/#findComment-310114
Share on other sites

Here's a better solution I think.  The files can still be named .php but appear to the user as .htm.

 

Just open up your .htaccess file and add the following:

 

RewriteEngine On

RewriteBase /

RewriteRule ^filename.htm$ filename.php

 

Make entries of the RewriteRule on a per file basis on the ones you want to look like they are .htm files. 

Link to comment
https://forums.phpfreaks.com/topic/62328-change-php-to-htm/#findComment-310242
Share on other sites

Here's a better solution I think.  The files can still be named .php but appear to the user as .htm.

 

Just open up your .htaccess file and add the following:

 

RewriteEngine On

RewriteBase /

RewriteRule ^filename.htm$ filename.php

 

Make entries of the RewriteRule on a per file basis on the ones you want to look like they are .htm files. 

 

A better way to do it would be with:

RewriteRule ^(.+)\.htm$ $1.php

 

That would rewrite every .htm file.

 

Anyway, if you can't add a type or use mod rewrite, you're kinda screwed...

 

I'm assuming this is shared hosting?

Link to comment
https://forums.phpfreaks.com/topic/62328-change-php-to-htm/#findComment-310321
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.