How to change .htm/.html into PHP or ASP pages

July 20, 2008 · Print This Article

If you have a website with lots of .htm or .html pages indexed on Google (or other search engine) and they have many backlinks, I’m sure you won’t let them deleted just because you want to serve dynamic content and change their extension to PHP or ASP pages. That’s enough reason why you have to read the tutor below on how to interpret .htm/.html into PHP or ASP pages in order to make them could serve dynamic content.
That could be done without changing the extention on the Apache Web Server for PHP or IIS Web Server for ASP.

Change .htm/.html to PHP pages
You could tell your Apache Web Server to interpret your .htm/.html files as .php files and serve dynamic content. Just add the following code:
AddType application/x-httpd.php .html .htm

On some Apache servers, they might require the following code line:
AddHandler x-httpd.php .html

or
addtype application/x-httpd-php .html
AddHandler x-httpd-php .html

Now test your pages by running this simple php code between < body> < /body> of your html pages:
< ?php echo 'Hello PHP World!'; ? >

If you open the page in a browser and it displays < ?php echo 'Hello PHP World!'; ? > in the page, means that something wrong with the code, try to check the installation code again. If it only displays Hello PHP World! means that you’ve done a great job!

Change .htm/.html to ASP pages
This is how to interpret a .htm/.html file as a .ASP file on your IIS Web Server.
Open IIS, then open the website that you would like to change.
Select Properties and on the Virtual Directory Tab, make sure you have an Application with Execute Permissions: “Script Only” or “Scripts and Executables”
Then click on the Configuration Button

Picture of change html to asp

Image of change htm to asp picture

Copy the Path from the .asp Application Mapping, and click Add.

Picture of HTML to ASP on IIS

Enter the Executable Path and extension (.htm), and click OK
Then you might have to restart the website.

Repeat the process for .html extentions

Your .htm pages will now be dynamic and able to interpret ASP Commands. You can validate that it is working by adding a simple script to the Body of your .htm page:

<% Response.Write ("Hello ASP World") %>

If you open the page in a browser and it displays in the page it didn’t parse the page correctly. If it only displays Hello ASP World! it parsed the page correctly.
If you are on a shared hosting server you will have to get your hosting company to do this for you. If they can’t or won’t you may have to get a Dedicated or Virtual Dedicated server.

Popularity: 23%


Possible Related Post:
How to make your Error 404 Pages Useful
How to Choose Free Hosting PHP
How to Make a Fake Google PageRank
Test the limit post
Gallery Navigation Plugin

Comments

Got something to say?