homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Converting static html site to php

 7:06 pm on Feb 5, 2008 (gmt 0)

I have a static html site which for various reasons I'd like to convert to a php site but still retain the .html extension on my pages. As far as I'm able to tell there are two ways of me doing this.

1) Using rewrite commands in the .htaccess file to 'show' .php pages as .html pages

2) Use the following command again in .htaccess which I presume passes all .htm and .html through the php processor

AddType application/x-httpd-php .htm .html

I'd really appreciate feedback from anyone who has gone through this process in the past and anyone's thoughts on the two options above.

Cheers in advance


PS Mods - if you feel this post is more suitable in another forum feel free to move - I posted here as I thought this the most likely forum to find some one who has gone through this process



 7:09 pm on Feb 5, 2008 (gmt 0)

the best way is to have the html extension parsed for php as you showed in #2


 7:16 pm on Feb 5, 2008 (gmt 0)

I have your #2 in my .htaccess also ... has worked great.


 7:21 pm on Feb 5, 2008 (gmt 0)

Thanks for the feedback guys.

I prefer the #2 option, seems a lot cleaner than #1.

Cheers JB


 10:34 pm on Feb 5, 2008 (gmt 0)

Wow thanks a lot for this thread, i had been wondering how to do this for the longest time, but never actually looked into it.

and its so easy too!


 8:03 pm on Feb 6, 2008 (gmt 0)

This is a very good reply, I am about to be in the same situation where i have a site that has htm pages but i wish to move over to php-nuke possibly how does this work? for example if one of my pages is www.mywebsite.com/documents/tech/adsl.htm my new php site wont look like that so how does the above example work? My site is a few hundred pages of htm at the moment, with loads of sites linking to various pages over the years and i dont want to loose those links people have.

Many Thanks


 8:27 pm on Feb 6, 2008 (gmt 0)

if you don't want to lose the links then don't change the urls

as above you can have php scripting at the exact same url, no changes, by enabling php parsing for other extensions, such as .html or .htm or any other

if you start using a nuke and you have to change your url structure then you need to 301 all those old pages to the new ones but you will notice a loss of ranking/traffic etc

the only way to lose nothing is to not change the urls


 8:34 pm on Feb 6, 2008 (gmt 0)

Thanks, i take it you mean for example current page is www.mywebsite.com/documents/tech/adsl.htm and on the php-nuke call it www.mywebsite.com/documents/tech/adsl.php

Just starting to play around with PHP been HTM site for years, there are out of the few hundred pages i have i would guess maybe only 50 or so are key ones according to my web stats.



 2:46 am on Feb 7, 2008 (gmt 0)

actually that would be changing the url

if the present url is

then leave it as

and enable php parsing for the htm extension


 3:21 am on Feb 7, 2008 (gmt 0)

...and over time, add new pages with URLs of www.mywebsite.com/documents/tech/adsl and then use mod_negotiation or mod_rewrite to resolve those extensionless URLs to either .html or .php files (it will no longer matter).

By getting rid of the 'file extensions' on your page URLs, you ensure that you'll never have to go through the exercise of changing your page URLs again.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved