Parsing PHP in web pages that end in .html or .htm, possible? Absolutely!
You're suddenly hosted on the Apache web server and perhaps you've just moved to a host that supports PHP and you want to try your hand at inserting cool PHP codes into them,
...you're probably thinking,
Oh man, now I have to rename all my web pages to newpage.php!. Think again...
You may leave your web pages as index.htm or whatever.html and just start inserting your PHP codes inside it and have it parsed just as if they were placed in anindex.php or whatever.php file!
Edit the .htaccess file
How? Well, here's what you should do:Go to your WWW root, usually it looks like this -
path: /home/username/public_html
Look for the file named .htaccess. If it's not there, create a blank page using NotePad or Dreamweaver and save it as .htaccess
Now edit this file by adding the following lines:
code:
Save and close the .htaccess file. Upload it to your webserver (to your WWW root) and that's it!RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html
Sample PHP code in a .html webpage
Now create a test file and filename it test.htmlCopy the following html into it:
php:
Upload it to your web server and view it using your browser. You will see that it works just fine.
<html>
<head></head>
<body>
<h1>
<?php echo "I LOVE PHP!"; ?>
</h1>
</body>
</html>
Once again great post. You seem to have a good understanding of these themes.When I entering your blog,I felt this . Come on and keep writting your blog will be more attractive. To Your
ReplyDeleteSuccess!
Classic Dresses
Classic Bridesmaid Dresses
trumpet wedding dresses
New Style Flower Girl Dresses