Welcome to WebmasterWorld Guest from 54.167.5.15

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Converting static html site to php

     

johnblack

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

JB

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

jatar_k

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

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

Barb

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

5+ Year Member



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

johnblack

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

GamingLoft

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

5+ Year Member



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!

duncan320

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

5+ Year Member



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

jatar_k

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

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

duncan320

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

5+ Year Member



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.

Thanks

jatar_k

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

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



actually that would be changing the url

if the present url is
www.mywebsite.com/documents/tech/adsl.htm

then leave it as
www.mywebsite.com/documents/tech/adsl.htm

and enable php parsing for the htm extension

jdMorgan

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

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



...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.

Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month