1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Converting to php

Discussion in 'HTML & Website Design' started by Kngavl, Nov 11, 2007.

  1. #1
    Okay I'm quite confused here, I want to convert one of ym sites to php. I hear suggestions everywhere where they say just change the html extention to php. Is this correct?
    I use godaddy and a problem is it doesn't parse php on html pages even if you tell it to in the .htaccess. (I'm a complete newbie when it comes to this, hell I don't even know what parse means, I just know it doesn't and I know the result of it.)
     
    Kngavl, Nov 11, 2007 IP
    freelancer4hire likes this.
  2. Mooseman

    Mooseman Peon

    Messages:
    453
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why do you want to convert it to .php?
    I don't know what you mean by they don't parse (I don't know what the word parse means) php on html pages? You mean you want to write .php on .html pages?? I haven't tried but I don't think it works. Just simply change your extension .html to .php and it should work? :S
     
    Mooseman, Nov 12, 2007 IP
    freelancer4hire likes this.
  3. aaron d.

    aaron d. Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Changing the extension will make the files technically php, but nothing will really change (except all your links).

    Parsing is what the server does behind the scenes to separate the HTML code from the PHP code and process/run the PHP code.

    I used to use godaddy a few years back and I thought it would parse pages regardless of extension. How are you testing if it is parsing the PHP?

    Did you try adding the following to your .htaccess file?
    RemoveHandler .html .htm
    AddType application/x-httpd-php .html .htm
    
    Code (markup):
     
    aaron d., Nov 12, 2007 IP
    freelancer4hire likes this.
  4. Kngavl

    Kngavl Peon

    Messages:
    964
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes I've tried, godaddy does not allow adding those lines to .htaccess. If I add those lines or variations of them to htaccess then the site shuts down and prompts the viewer to download a file. Godaddy wont allow you to parse .php on html pages but if the page is php then it will.
     
    Kngavl, Nov 13, 2007 IP
  5. aaron d.

    aaron d. Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    They may be using php5. Try:

    <code>RemoveHandler .html .htm
    AddType application/x-httpd-php5 .html .htm</code>
     
    aaron d., Nov 13, 2007 IP
  6. Kngavl

    Kngavl Peon

    Messages:
    964
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #6
    No it doesn't matter, godaddy will not allow that command in htaccess, there is no way to by pass other then to make page into php.
     
    Kngavl, Nov 13, 2007 IP
  7. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #7
    Why do you want to change the extensions of your site's filenames to ".php" ? Do you have a reason for that? Are you planning to add some dynamic scripting?
     
    soulscratch, Nov 13, 2007 IP
    freelancer4hire likes this.
  8. Kngavl

    Kngavl Peon

    Messages:
    964
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Ai is it even worth mentioning once more... for the last time, I am hosted on Godaddy. As such if I want to parse php code on an html page the conventional way would be to add some text to an .htaccess file, HOWEVER*** I can not do this as godaddy doesn't allow it, thats that. No by passing it. However if the page is in .php then the php scripts will run on the page.
    LOL
     
    Kngavl, Nov 13, 2007 IP
  9. deques

    deques Peon

    Messages:
    206
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #9
    im very confused on what you want.
    do you want php scripts in your html files? then its not possible

    do you want html in php files? and just want to use them as normal html. Why? is there any reason behind this? I dont see any reason to rename html files to php just to use them as normal html files. php doesnt make the site better, or rank better in search results.

    are you planning to add some functionality to your site, such member registration? guestbook?
     
    deques, Nov 14, 2007 IP
    freelancer4hire likes this.
  10. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #10
    1. ur name of files should be php
    2. in .htaccess tell that donot show php as file extension show html as file extention

    This is solution for what u r asking

    Regards

    Alex
     
    kmap, Nov 14, 2007 IP
    freelancer4hire likes this.
  11. deques

    deques Peon

    Messages:
    206
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #11
    and that way i find renaming files to php and then tell .htaccess to go back to html very stupid. no reason to rename to php just to use the files as normal html files, when there are no functionality

    html -> php -> html
    is this some kind of loop? lol
     
    deques, Nov 14, 2007 IP
  12. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #12
    i'm pretty sure he was telling you how to set it up so that you're files are parsed as php but the urls do not change for the user....
     
    Jamie18, Nov 14, 2007 IP
    freelancer4hire likes this.
  13. Kngavl

    Kngavl Peon

    Messages:
    964
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I give up hahahahah.
    I want php scripts to run on a html page.
    I can't do this however because if I place php code in a html page it is not parsed due to restrictions palced by my host.
    However if my whole page is in .php then the php script on the page will work (AKA SUCCESS).
    I want to know, if I want to convert my index.html page to php, do I just change the extension and thats it and it will work? Or do i have to add other commands and such like echo or whatever the hell that is.
     
    Kngavl, Nov 14, 2007 IP
  14. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #14
    There are two solutions to this that I can think of.

    One would be to convert all pages to ".php" and setup 301 Redirects on your old ".html" pages to the php ones.

    The other would be to get a new host that lets you screw around with .htaccess.
     
    soulscratch, Nov 14, 2007 IP
  15. Kngavl

    Kngavl Peon

    Messages:
    964
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Okay sweet thats what I was looking for, one more thing (Oh no).
    If its a new site do I still need to redirect (as in, do I still need the html page to redirect from?)
     
    Kngavl, Nov 14, 2007 IP
  16. BackOfTheNet

    BackOfTheNet Peon

    Messages:
    344
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I had major issues with this as I wrote one of my sites in html then realized I needed to parse php in the html files after a couple of hours looking around for answers as I too use godaddy I contacted them and they enabled it for me they also gave me this to code to add to my .htaccess file You have to be aware of what version of php your database your site is using so 5 add a 5 or 4 add a 4 simnpole you can find that info in the Database cpanel.

    You als need to be on linux and running hosting config 2.0 alll this info you will find in your hosting cpanel

    https://hostingmanager.secureserver.net/AccountPanel.aspx

    #htaccess mod rewrite code
    Options +FollowSymLinks -MultiViews
    RewriteEngine On
    RewriteBase /

    #AddType x-mapp-php4 .html .htm
    AddHandler x-httpd-php .html .htm .cgi .php


    If you unsure PM and ill arrange to send you my .htaccess file


    Hope this helps buddy!
     
    BackOfTheNet, Nov 15, 2007 IP
    freelancer4hire and Kngavl like this.
  17. Kngavl

    Kngavl Peon

    Messages:
    964
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Thank you very much for that code, I'm going to try it right now. One thing, do I have to ask Godaddy to enable it or will this code suppliment it?
     
    Kngavl, Nov 15, 2007 IP
  18. BackOfTheNet

    BackOfTheNet Peon

    Messages:
    344
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Try the code see if it works bud if not ask godaddy like I did and they will enable it for you

    Best of luck m8y
     
    BackOfTheNet, Nov 15, 2007 IP