Jump to content

[MIX]How to replace PHP ext with HTML ?


Recommended Posts

:yes: Calling all webmasters and brains on buildtolearn :

I want to embed a PHP page / code in a .html page (html extension)

Pls tell me how to do it

Also i dont want to use the frame tag.

Basically i want to replace the php extension of a webpage with html

Pls help :)

I need it

Link to comment
Share on other sites


Uh, do you have control over the server configuration...

for instance on Apache, you simply add a new AddHandler call to the Apache httpd.conf file... theres a lot online to do it with... just take a look around, with IIS, same kind of thing, but its more complicated, same story though, just look around for changing the handlers of files...

Link to comment
Share on other sites

  • 2 weeks later...

this is somewhat simple.. actually, the first example here :)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>php in html</title>
</head>
<body>

<?php
print "hello! i work!";
?>

</body>
</html>

Edited by RayOK
Link to comment
Share on other sites

unfortunatly, that wont work unless the server realizes it needs to process the page though the PHP preparser... you'll notice that that page still has a *.PHP extenstion, the question asked about PHP in a file with a *.HTML extension.

Link to comment
Share on other sites

Ahh.. I see now. I spoke with my good buddy, the server admin, and he said its a setting in the Apache config file. Its "AddType application/x-httpd-php .php .php4 .php3 .phtml .html" Just add the extension to the list :)

Edited by RayOK
Link to comment
Share on other sites

  • 1 month later...

Yes, you just need to edit your Apache config file and add the .HTML extension to be passed to your PHP module.

But keep in mind this means EVERY .HTML on your site must pass through the PHP module, which slows your site down a little bit. If the site is very busy, this can become a problem but for the average website, it isn't.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...