Results 1 to 7 of 7

Thread: php on .html?

  1. #1

    php on .html?

    Hi all,

    I've heard that some servers will execute PHP code on .html documents.

    I would appreciate your recommedations about hosts with servers that will do this.

    Why do I need this? I've just bought a site that has handcoded footers on .html pages. Of course the footers must be PHP, but I can't change the file extensions, because of SEO.

    Thanks in advance,


  2. #2
    Any host that support .htaccess will allow you to do this.

    Just create a .htaccess file and put the following in it:

    AddType application/x-httpd-php .php .php3 .php4 .phtml .html

    Problem with doing this is that EVERY .html file, whether it has php code or not, will be put thru he parser.

  3. #3
    Join Date
    Aug 2005
    Barcelona, Spain
    you can also mod_rewrite the .php pages to .html
    hi there!

  4. #4
    Thanks for your suggestion, ArtieFishill.

    I know your code to be correct, but in my case it produced an error. I will have to contact support about this.

    Thanks for pointing me in the right direction.

    - - you can also mod_rewrite the .php pages to .html - -

    That's also a possibility, thanks.

  5. #5
    RewriteRule (.*)\.html$ $1\.php [T=application/x-httpd-php,L]

    This does the trick. But I will have to rename all my pages from .html to .php.

  6. #6
    Join Date
    Apr 2002
    South Carolina
    they can add the call in apache as well
    Carolina Hosting Services | @CarolinaHosting |
    VMware | cPanel | Linux | Softaculous | 16 Years Hosting Experience

  7. #7
    Join Date
    Oct 2002
    EU - east side
    I use this in .htaccess:

    AddHandler application/x-httpd-php .htm

    It does the job.

    (Yes, I'm old fashioned and use .htm. Actually, I don't want to change all the file names and mess up the search engines. )

Posting Permissions

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