php in ".html" documents

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • petermichaux@yahoo.com

    php in ".html" documents

    Hi,

    On my computer apache will see php in .php documents but not in .html
    documents. Can I configure apache to see php in .html documents? Or is
    this something that cannot be done at all?

    Thanks,
    Peter

  • Andrew DeFaria

    #2
    Re: php in ".html&quo t; documents

    petermichaux@ya hoo.com wrote:
    [color=blue]
    > Hi,
    >
    > On my computer apache will see php in .php documents but not in .html
    > documents. Can I configure apache to see php in .html documents? Or is
    > this something that cannot be done at all?[/color]

    Rename the .html file as .php! ;-)
    --
    Optirectumitis - where the optic nerve gets crossed with the rectal
    nerve resulting in a crappy outlook on life.

    Comment

    • Malcolm Dew-Jones

      #3
      Re: php in ".html&quo t; documents

      petermichaux@ya hoo.com wrote:
      : Hi,

      : On my computer apache will see php in .php documents but not in .html
      : documents. Can I configure apache to see php in .html documents? Or is
      : this something that cannot be done at all?

      Yes. The apache config file can be used to control how apache handles a
      file. So just tell apache to handle all html files within some area as if
      they were php files, As long as they don't use <?php for some other reason
      then everything should work like you want (though slower for the files in
      that area).

      Because the html files are really programs you must be more careful with
      security.

      You'll have to lookup the details though, I don't have an example I can
      easily refer to or test.

      (Caveat, I haven't done exactly this task ever, only things that are
      pretty similar.)


      --

      This space not for rent.

      Comment

      • Dan  Fulbright

        #4
        Re: php in &quot;.html&quo t; documents

        > On my computer apache will see php in .php documents but not in .html[color=blue]
        > documents. Can I configure apache to see php in .html documents? Or is
        > this something that cannot be done at all?[/color]

        Add this to .htaccess:

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

        Comment

        • Andrew DeFaria

          #5
          Re: php in &quot;.html&quo t; documents

          Dan Fulbright wrote:
          [color=blue][color=green]
          >> On my computer apache will see php in .php documents but not in .html
          >> documents. Can I configure apache to see php in .html documents? Or
          >> is this something that cannot be done at all?[/color]
          >
          > Add this to .htaccess:
          >
          > AddType application/x-httpd-php .php .html[/color]

          I don't think it particularly wise to have all .html files always
          treated and processed as .php files. That's why I said "If you want a
          ..html file to be treated as a .php file then rename it".

          --
          If it's zero degrees outside today and it's supposed to be twice as cold
          tomorrow, how cold is it going to be?

          Comment

          • Michel

            #6
            Re: php in &quot;.html&quo t; documents

            Which was an answer to a question that wasn't asked.


            I don't think it particularly wise to have all .html files always treated
            and processed as .php files. That's why I said "If you want a .html file to
            be treated as a .php file then rename it".

            --
            If it's zero degrees outside today and it's supposed to be twice as cold
            tomorrow, how cold is it going to be?


            Comment

            • BearItAll

              #7
              Re: php in &quot;.html&quo t; documents

              On Tue, 21 Jun 2005 05:31:48 +0000, Andrew DeFaria wrote:
              [color=blue]
              > Dan Fulbright wrote:
              >[color=green][color=darkred]
              >>> On my computer apache will see php in .php documents but not in .html
              >>> documents. Can I configure apache to see php in .html documents? Or is
              >>> this something that cannot be done at all?[/color]
              >>
              >> Add this to .htaccess:
              >>
              >> AddType application/x-httpd-php .php .html[/color]
              >
              > I don't think it particularly wise to have all .html files always treated
              > and processed as .php files. That's why I said "If you want a .html file
              > to be treated as a .php file then rename it".[/color]

              Particularly unwise if the pages will be used on any other server than his
              own.

              Comment

              • Andrew DeFaria

                #8
                Re: php in &quot;.html&quo t; documents

                Michel wrote:
                [color=blue]
                > Which was an answer to a question that wasn't asked.
                >
                > I don't think it particularly wise to have all .html files always
                > treated and processed as .php files. That's why I said "If you want a
                > .html file to be treated as a .php file then rename it".[/color]

                Huh?
                --
                I'm not tense, just terribly, terribly alert.

                Comment

                • John Dunlop

                  #9
                  Re: php in &quot;.html&quo t; documents

                  Another nameless somebody wrote:
                  [color=blue]
                  > On my computer apache will see php in .php documents but not in .html
                  > documents. Can I configure apache to see php in .html documents?[/color]

                  <.html.php>?

                  --
                  Jock

                  Comment

                  • John Dunlop

                    #10
                    Re: php in &quot;.html&quo t; documents

                    Michel wrote:
                    [color=blue]
                    > Which was an answer to a question that wasn't asked.[/color]

                    which is alright in my book!!


                    'top posting'

                    [just for you, Michel, that was another answer to a question
                    that wasn't asked - can you tell what it is yet?]

                    --
                    Jock

                    Comment

                    • Malcolm Dew-Jones

                      #11
                      Re: php in &quot;.html&quo t; documents

                      Michel (no@spam.please ) wrote:

                      : I don't think it particularly wise to have all .html files always treated
                      : and processed as .php files. That's why I said "If you want a .html file to
                      : be treated as a .php file then rename it".

                      which is why I suggested that this be defined for "an area" within the
                      server.

                      One reason to treat html as php might be because a site has pages that
                      have been static in the past, and they wish to enhance those pages to be
                      dynamic without breaking any existing links.

                      Rewrite rules could do that to, but simply turning on php for html sounds
                      like the easiest way to do it, perhaps as a temporary measure during some
                      conversion period.


                      --

                      This space not for rent.

                      Comment

                      • Andrew DeFaria

                        #12
                        Re: php in &quot;.html&quo t; documents

                        Malcolm Dew-Jones wrote:
                        [color=blue]
                        > Michel (no@spam.please ) wrote:
                        >
                        > : I don't think it particularly wise to have all .html files always
                        > treated
                        > : and processed as .php files. That's why I said "If you want a .html
                        > file to
                        > : be treated as a .php file then rename it".
                        >
                        > which is why I suggested that this be defined for "an area" within the
                        > server.
                        >
                        > One reason to treat html as php might be because a site has pages that
                        > have been static in the past, and they wish to enhance those pages to
                        > be dynamic without breaking any existing links.
                        >
                        > Rewrite rules could do that to, but simply turning on php for html
                        > sounds like the easiest way to do it, perhaps as a temporary measure
                        > during some conversion period.[/color]

                        It's the wrong way to go about it. Rename the files from .html -> .php
                        and adjust the corresponding links - that's the proper way.
                        --
                        Sign seen in a bar: "Those drinking to forget please pay in advance"

                        Comment

                        • Malcolm Dew-Jones

                          #13
                          Re: php in &quot;.html&quo t; documents

                          Andrew DeFaria (Andrew@DeFaria .com) wrote:
                          : This is a multi-part message in MIME format.
                          : --------------020109070304080 007040301
                          : Content-Type: text/plain; charset=ISO-8859-1; format=flowed
                          : Content-Transfer-Encoding: 7bit

                          : Malcolm Dew-Jones wrote:

                          : > Michel (no@spam.please ) wrote:
                          : >
                          : > : I don't think it particularly wise to have all .html files always
                          : > treated
                          : > : and processed as .php files. That's why I said "If you want a .html
                          : > file to
                          : > : be treated as a .php file then rename it".
                          : >
                          : > which is why I suggested that this be defined for "an area" within the
                          : > server.
                          : >
                          : > One reason to treat html as php might be because a site has pages that
                          : > have been static in the past, and they wish to enhance those pages to
                          : > be dynamic without breaking any existing links.
                          : >
                          : > Rewrite rules could do that to, but simply turning on php for html
                          : > sounds like the easiest way to do it, perhaps as a temporary measure
                          : > during some conversion period.

                          : It's the wrong way to go about it. Rename the files from .html -> .php
                          : and adjust the corresponding links - that's the proper way.

                          Hum, lets get this right, I change the name and then ask google, or any
                          number of other sites that link to me, to change their links.

                          Could you explain how that works again...


                          --

                          This space not for rent.

                          Comment

                          • Andrew DeFaria

                            #14
                            Re: php in &quot;.html&quo t; documents

                            Malcolm Dew-Jones wrote:.
                            [color=blue]
                            > Hum, lets get this right, I change the name and then ask google, or
                            > any number of other sites that link to me, to change their links.
                            >
                            > Could you explain how that works again...[/color]

                            Links that cross sites were never, repeat never meant to be golden. They
                            change when they change. You cannot control the world and you cannot
                            rely that links will remain constant forever. Google will eventually
                            automatically adapt anyway.

                            What are you suggesting in your scenario anyway? That people open up a
                            potential security hole changing all of their .html files to be run as
                            though they are .php forever?
                            --
                            Hang up and drive.

                            Comment

                            • Jerry Stuckle

                              #15
                              Re: php in &quot;.html&quo t; documents

                              Malcolm Dew-Jones wrote:[color=blue]
                              > Andrew DeFaria (Andrew@DeFaria .com) wrote:
                              > : This is a multi-part message in MIME format.
                              > : --------------020109070304080 007040301
                              > : Content-Type: text/plain; charset=ISO-8859-1; format=flowed
                              > : Content-Transfer-Encoding: 7bit
                              >
                              > : Malcolm Dew-Jones wrote:
                              >
                              > : > Michel (no@spam.please ) wrote:
                              > : >
                              > : > : I don't think it particularly wise to have all .html files always
                              > : > treated
                              > : > : and processed as .php files. That's why I said "If you want a .html
                              > : > file to
                              > : > : be treated as a .php file then rename it".
                              > : >
                              > : > which is why I suggested that this be defined for "an area" within the
                              > : > server.
                              > : >
                              > : > One reason to treat html as php might be because a site has pages that
                              > : > have been static in the past, and they wish to enhance those pages to
                              > : > be dynamic without breaking any existing links.
                              > : >
                              > : > Rewrite rules could do that to, but simply turning on php for html
                              > : > sounds like the easiest way to do it, perhaps as a temporary measure
                              > : > during some conversion period.
                              >
                              > : It's the wrong way to go about it. Rename the files from .html -> .php
                              > : and adjust the corresponding links - that's the proper way.
                              >
                              > Hum, lets get this right, I change the name and then ask google, or any
                              > number of other sites that link to me, to change their links.
                              >
                              > Could you explain how that works again...
                              >
                              >
                              > --
                              >
                              > This space not for rent.[/color]

                              Just set up a permanent redirect from the old file to the new one.
                              Google will adjust accordingly when it next spiders.

                              Simple, really. And, like Michel said, it's the proper way to do
                              things. After all - what happens if, for instance, your hosting company
                              goes under - and your new host doesn't allow you to parse .html files
                              for php?

                              --
                              =============== ===
                              Remove the "x" from my email address
                              Jerry Stuckle
                              JDS Computer Training Corp.
                              jstucklex@attgl obal.net
                              =============== ===

                              Comment

                              Working...