parsing html docs with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mjmacarty
Forum Commoner
Posts: 37
Joined: Tue Feb 21, 2006 3:20 pm

parsing html docs with php

Post by mjmacarty »

So am I correct in assuming, creating a .htaccess file with the following:

AddType x-mapp-php4 .html .htm


will allow php code in a .html file to be executed (i.e. index.html)?

IS this pretty much the best solution if you have code in your index file that needs executing?

I know this is kind of basic, but I just need some reassurance! After all I am a code baby.
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

Post by Citizen »

Why dont yo just name your index as index.php?

Any index.whatever will count as your index file.
mjmacarty
Forum Commoner
Posts: 37
Joined: Tue Feb 21, 2006 3:20 pm

Post by mjmacarty »

Ok. Thanks. But this doesn't work on my development server. Is there a switch httpd.conf file for Apache?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The normal command for AddType is

Code: Select all

AddType application/x-httpd-php .html
http://httpd.apache.org/docs/trunk/mod/ ... ml#addtype

Index files are set with the DirectoryIndex directive in the conf or .htaccess files. http://httpd.apache.org/docs/2.2/mod/mo ... ctoryindex
mjmacarty
Forum Commoner
Posts: 37
Joined: Tue Feb 21, 2006 3:20 pm

Post by mjmacarty »

Thanks!
Post Reply