• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

PHP pages

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    PHP pages

    If I want to use PHP in some of my pages and don't want to faff around too much with Apache handlers can I simply just rename my .html pages to .php?

    All the server side scripting stuff is working but the page I want to run the script on has a .html extension - is there anything else I need to consider before just renaming the extension to php?

    Also if I do this will it have an adverse affect when the search engines spider my page - ie, will they see it as a new page and I'll have to SEO that new page from square 1?
    "Is someone you don't like allowed to say something you don't like? If that is the case then we have free speech."- Elon Musk

    #2
    Erm.

    You have to tell apache to handle the .php page as a PHP page otherwise it won't work and won't use the apache engine.

    If you don't want to change the extension you could tell apache to handle html pages as php pages and just stick the php in there.

    A standard html page sent through apache/php will just come out the same as it went in only when it find <?php ?> to process does the page change.

    Comment


      #3
      Thanks for that - Apache is handling PHP pages OK.

      I have used test PHP pages to see if this script works and it does. The problem is with getting PHP to work in pages with a .html extension.

      I have set up handlers to tell apache to handle html as PHP but it's not working - even after going through it with my hosting company several times.

      That's why I'm just tempted to change the extensions of the html pages to .php - I'm just concerned about:

      1. Do I need to do anything else to the pages themselves apart from rename them?

      2. If those pages are on the first page of Google/Yahoo/MSN will they get dropped if I change the file extension?
      "Is someone you don't like allowed to say something you don't like? If that is the case then we have free speech."- Elon Musk

      Comment


        #4
        have you modified httpd.conf to have something like

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

        Comment


          #5
          Originally posted by FiveTimes View Post
          have you modified httpd.conf to have something like

          AddType application/x-httpd-php .php .html
          Yeah I've done that, I did it with an option in my Cpanel there's something up with either the script or my hosting company.

          The guy who wrote the script is working on getting html pages to be treated as PHP. I've posted on another forum and had an answer that if I do rename the html files to php they will be treated by the search engines as new files and indexed as new pages so they're staying as html

          I'll just be patient and wait.....
          "Is someone you don't like allowed to say something you don't like? If that is the case then we have free speech."- Elon Musk

          Comment


            #6
            Originally posted by Jog On View Post
            Yeah I've done that, I did it with an option in my Cpanel there's something up with either the script or my hosting company.

            The guy who wrote the script is working on getting html pages to be treated as PHP. I've posted on another forum and had an answer that if I do rename the html files to php they will be treated by the search engines as new files and indexed as new pages so they're staying as html

            I'll just be patient and wait.....
            Could always try adding a index.php and changing the index.html to auto redirect to the index.php.

            Comment


              #7
              Or you could use Mod_Rewrite to point blah.html at blah.php

              You may have to learn to love regex

              Comment


                #8
                I think I'll just redirect the html pages to the php pages while I split test them until they fix the apache handler thing or whatever it is that's stopping PHP in html pages.

                And create .php pages from now on - at least for the ones I intend to split test anyway
                "Is someone you don't like allowed to say something you don't like? If that is the case then we have free speech."- Elon Musk

                Comment


                  #9
                  You could also try putting the following in an .htaccess file (assuming that apache is serving files):

                  Code:
                  <FilesMatch "\.(html)$">
                     SetHandler application/x-httpd-php
                  </FilesMatch>
                  (assuming you haven't already done this)
                  Last edited by Ardesco; 11 February 2008, 16:17.

                  Comment


                    #10
                    Unfortunately I can't use the .htaccess file for things like that now as my hosting company has moved the goalposts somewhat..

                    Even with their php.ini file and apache handlers set up in Cpanel it doesn't work.

                    I'll wait and see if the guy who wrote my split testing script can fix it as I've done everthing the hosting company said to in that thread

                    Otherwise I'll redirect for the exisiting pages and just write php pages from now on.
                    "Is someone you don't like allowed to say something you don't like? If that is the case then we have free speech."- Elon Musk

                    Comment

                    Working...
                    X