Welcome to WebmasterWorld Guest from 220.127.116.11
use a rewrite so that you continue to use the same old .html URLs as before but the rewrite now connects those URL requests to the new internal .php filenames,
rename the new PHP files so that they have the same filenames as before and use the same .html extension as before, and then use AddHandler to ensure those .html files are parsed for any PHP scripts within them.
In this way, users will see and use the same URLs that they always have. There is absolutely no need to change the URLs used by your site when you change from static HTML files to having HTML being generated by PHP scripts.
Also, something wierd happened to the .htaccess file that I had on the server. I had redirected each htm file individually to a php file, but when I opened that .htaccess file yesterday, it was blank. Why would that happen?
To get php to be parsed use this to your .htaccess:
AddHandler application/x-httpd-php .htm .html
If that doesn't work and you are using php 5, this might help:
AddHandler application/x-httpd-php5 .htm .html
That will allow you to keep index.html as it is and put php code in it instead of renaming it to index.php
If you aren't sure, ask your hosts for help. Most will usually be more than willing to oblige.
No. Do NOT redirect .htm to .php because that creates new URLs out on the web.
Use the same URLs out on the web and implement a rewrite or a handler inside the server.
A rewrite is different to a redirect.
If your .htaccess went blank, something else wrote over it; possibly the control panel for your site.
I tend to use any file extension I want and when I make links to the files, omit the extension. If you have Apache, setup Content Negotiation. See ]http://httpd.apache.org/docs/2.0/content-negotiation.html. Instead of using http://example.com/page.html or http://example.com/page.php visitors can just type http://example.com/page and Apache will just serve up the correct document (you can use .htm or .php!).
Also, in order to use PHP you do not have to use a .php extension. As said above, you can just setup PHP to work in .htm documents as well (I personally use PHP in .xhtml documents).
Moving to a new URL breaks all incoming links and search-engine listings pointing to the old URL for the page (with resultant loss of traffic), and leaves visitors seeing "Error 404" messages, if the old URLs are not being redirected to the new URLs.
You are better off keeping the old URLs on the web, and letting the server accept those requests and continue to directly serve the same content. There's several ways to do it, and all are simple and commonly-used solutions.
I would use .htm URLs on the web, and matching .htm files on the server with AddHandler to tell the server to look inside those files for PHP scripting instructions.
If you prefer the rewrite, where you match .htm URL requests with their respective .php files in the server, there have been at least four questions asked and answered about rewriting URLs to .php files in the Apache forum in the last few days. Start there for examples of both methods.