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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.