+ Reply to Thread
Results 1 to 7 of 7

 

Thread: Change HTML file to PHP file

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Oct 2006
    Posts
    143
    Thanks
    0
    Thanked 0 Times in 0 Posts


    Hi,

    I got a quick question which I hope to have a simple and quick solution. I am currently undergo massive changes on my website pages. All my web pages were html format, and I want to change it to PHP format. Is there any alternative way to do it beside manually? I have in totally more than 100 html pages..... :scared

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Jun 2008
    Posts
    658
    Thanks
    3
    Thanked 32 Times in 27 Posts
    It still depends on what you want to do ? why do you now want php

    What do you want to move to database ?

    As far as I am aware there is no magic way.. straight forward html will hold up by just changing the file..

    I would also change your htaccess to change incoming html links directly in to .php assuming you are keeping the same file names..

    edit: hold on I could be wrong... How to convert a HTML website to PHP - Visitor Stats 2

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Gillingham
    Posts
    510
    Thanks
    0
    Thanked 4 Times in 1 Post
    I'm not too sure about what you are trying to do, but here are a few suggestions.

    1/ Add apache handlers in .htaccess so that your html files work as php files.
    Code:
    AddHandler application/x-httpd-php .htm
    AddHandler application/x-httpd-php .html
    (Note if you are running under windows you may have to activate .htaccess)

    2/ Write a script in php to load the files, change the local links and then save them with a php extension.

    3/In dreamweaver (other software may work) change the filenames to ".php" and click the popup that ask you if you want to update links.
    They came for my 404 and I said nothing

  4. #4
    DioBach's Avatar
    .com

    Status
    Offline
    Join Date
    Dec 2006
    Location
    Tenby, Wales, UK
    Posts
    776
    Thanks
    15
    Thanked 16 Times in 10 Posts
    Also beware, if you have good rankings on pages, be certain to 301 to the new .php page (if you change the extensions) as it should pass your rankings on to the new page, otherwise, you lose all the good stuff the old page had.

  5. #5
    Registered User

    Status
    Offline
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what do you want to do ?

    if you want to centralize duplicate content that could be done by extracting it first
    and creating either include files or DB entries.

    if you want to add something to all your pages.

    you could just add auto_prepend_file or auto_append ...

    please be more specific, PHP is very powerful, I doubt you have to go through all your files to perform repetitive work.

  6. #6
    Registered User

    Status
    Offline
    Join Date
    Oct 2006
    Posts
    143
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks guys, thanks for the comments.

    the main reasons why I want to change to php are mainly due to two reasons,

    1) First, it is more easier to manage when I want to amend the pages. I can use include {file} to do that. Previously, when I want to change one item/link or menu bars, I need to go through all those files to change it. I think with php, I can use include{} to do that, so it saving me a lot of effort and time.

    2) Secondly is more due to tracking purposes, some of the programmes are mainly referral link to merchant, so with php I can easily setting session tracking or similar alike.

  7. #7
    Registered User

    Status
    Offline
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do you use php already ?

    if so . using str_replace / preg_replace you should be good
    to replace your actual menus and header / footer (common parts) by include files.

    Just make sure you save your new files to a different folder and you can easily go live by moving the files when you are ready.

    I don't suggest you change the filenames since you are going to lose PR.

    I hope it helps

+ Reply to Thread


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP - No input file specified. - Problem
    By Barry in forum Programming
    Replies: 1
    Last Post: 02-08-04, 11:57 AM
  2. HTML and PHP help
    By Bosh123 in forum Programming
    Replies: 7
    Last Post: 10-05-04, 06:44 PM
  3. PHP write file that is writable
    By scifind in forum Programming
    Replies: 3
    Last Post: 30-01-04, 10:12 AM
  4. Downloading a file using PHP
    By wibble99 in forum Programming
    Replies: 10
    Last Post: 19-01-04, 02:15 PM
  5. PHP File Security for Includes
    By bonedome in forum Programming
    Replies: 0
    Last Post: 01-01-04, 09:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2