Page 1 of 1
How to get .html pages to compile PHP code
Posted: Fri Sep 09, 2005 5:29 pm
by eggerda
Hello,
I am a novice to PHP and am working with someone who wants to have all of the pages on their site with .html extensions, but wants those pages to be able to compile PHP.
Is this possible? If so, how, and is it easy?
Thanks,
Dan
P.S. It's a standard Unix webhost using PHP 4.0
Posted: Fri Sep 09, 2005 5:39 pm
by feyd
quite simple in most servers, you simply map the file extension to be used by php
Code: Select all
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
on Apache servers...
Posted: Fri Sep 09, 2005 5:41 pm
by deltawing
I'm assuming you're using Apache here. If you have access to the httpd.conf file, there's a section that looks like this:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
Just add this line underneath:
AddType application/x-httpd-php .html
The trouble is, if its a hosting company, you probably won't have access to the httpd.conf file. You could ask your hosting company to do it for you, but I doubt they will, because that'll affect other users too.
Edit: Damn, beaten to it.
Posted: Fri Sep 09, 2005 5:44 pm
by feyd
deltawing wrote:Edit: Damn, beaten to it.
mwhahahahahha it's all apart of my diabolical plan..

Posted: Fri Sep 09, 2005 5:51 pm
by eggerda
Unfortunately, I am using servers at a hosting company.
Is there no other way to do it, or to make it so it won't effect other sites on the same server? I'm keeping my fingers crossed here...
Dan
Posted: Fri Sep 09, 2005 5:53 pm
by deltawing
feyd wrote:deltawing wrote:Edit: Damn, beaten to it.
mwhahahahahha it's all apart of my diabolical plan..

You were two seconds ahead of me! Diabolical is the word.
I'm trying to think of some sort of good programming practice pun on that. Ideas, anyone?
And no, sorry. I can't think that there is. You could try sending your hosting company an email asking them if it would be possible for them to set that up for you. It all depends on how they have set up the shared server, and I don't really know how that stuff works.
Posted: Fri Sep 09, 2005 6:25 pm
by feyd
hosts often make it accessible in some fashion.. if you're using cpanel for the control panel, go through the mime-types menu to add it. I'm not entirely sure about other cp's
Posted: Sat Sep 10, 2005 3:58 am
by William
Edit your .htaccess file? Thats usually what cPanel does is just add stuff to his .htaccess file.
Posted: Sat Sep 10, 2005 7:27 am
by feyd
hmmm, I could have swore remembering AddType was only allowed in the config, but looking it up, nope.. so yeah, into an .htaccess file will also do the trick.
Posted: Sat Sep 10, 2005 10:08 am
by William
The only reason I knew that was because a project I am working on was going to have the extention .xms for all of its files. But then we decided not to because then it would have to only be done with Apache.