HTML + PHP + Apache Handler

jeremy.king

macrumors 603
Original poster
Jul 23, 2002
5,479
1
Fuquay Varina, NC
Would it be considered bad practice to associate .htm(l) files with the PHP handler in apache?

I am working on a client site that has hundreds of html files and I want to slowly transition those to template based php files but can't do so at the speed that I would like since I have about 5-10 hours of free time every week. Renaming all of them to *.php would require me to update all sorts of links and I am lazy (just ask my wife ;) ) , so I thought "Why don't I just force all .htm(l) files through the parser?"

Is this bad taste/lazy/frowned upon?

Your advice is appreciated.
 

jaseone

macrumors 65816
Nov 7, 2004
1,245
57
Houston, USA
What benefit is that going to provide you with anyway? You will still have to edit each file to make use of the templating anyway.

There isn't really any reason why you can't do what you suggest but I wouldn't call it good practice by any means. To fix broken links en masse you can do something like use mod_rewrite or make a custom 404 error page in PHP that redirects to the right file.
 
Comment

jeremy.king

macrumors 603
Original poster
Jul 23, 2002
5,479
1
Fuquay Varina, NC
jaseone said:
What benefit is that going to provide you with anyway?
The fact that all my html files will be able to execute PHP code is one benefit. Perhaps I wasn't as clear as possible.

Here is my situation

a.htm is linked to from some 50+ other html files. So if I rename a.htm to a.php, I have to make 50 edits. Problem is I don't have the time to do this all at once, so if I rename it I am going to break existing links I am working on a LIVE site. So I was thinking - first lets make a.htm leverage include files (using php's include() function) to generate the header, footer, and other page elements - This will accomplish my goal of more template based development (not going as far as smarty, yet) while not breaking existing links.

You see, once I get all of the html files fixed to use include files, I can then change filenames to something more appropriate, update my include file(s), and be done with it.

Its just a stop gap for me to slowly add dynamic code to existing pages without having to rename files and update links (until the end)

Does that make more sense?
 
Comment

rendezvouscp

macrumors 68000
Aug 20, 2003
1,526
0
Long Beach, California
I'd say knock yourself out. It doesn't matter if it's bad practice, it's that you get the work done with a minimal amount of downtime (possibly none if you're able to execute your idea properly). I'd test it on a smaller scale first though before making the site-wide changes, if you can.

And, in the end, you will be fixing it correctly, because this is just a temporary solution. By all means, go ahead!
-Chase
 
Comment

Rower_CPU

Moderator emeritus
Oct 5, 2001
11,219
0
San Diego, CA
Other than a performance hit, I don't see why it'd be too bad - of course you're straying into the realm of semantics with file extensions/file types but since PHP and HTML can co-exist happily, you should be fine.
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.