SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 1999
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using PHP in .html files

    I've asked this question before, but the answer was not sufficient. I wish to make it so that .html files are processed through the PHP engine, not just .php extended files.

    Now my problem is, I was given the code:

    AddType application/x-httpd-php .html

    to add to my .htaccess file. But when I have that code along side:

    AddType text/html .shtml
    AddHandler server-parsed .shtml .html

    any page with .html ending becomes a download link for some reason. IE brings up the download box when a link with such an extension is clicked upon.

    So here's my problem, I need to be able to have regular .html files not only parse for ssi, but for php as well. How can I do this without having the problem mentioned above?

  2. #2
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just use the addtype and cutout .html on server parsed, because apache is thinking your attempting to use SSI with an html page.

    its worth a shot, I am no expert on apache.
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 1999
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thank you for your amazingly quick response, but that is exactly what I'm trying to do.

    Here is the situation.

    I am on the verge of converting my site from html to php. Now that html was not regular html, I had it set so that I use SSI within a regular .html file. But now, I want to use PHP within a regular .html file.

    The problem is, my site is split along those lines, and will take some time to convert all of the files. So what I have are certain .html pages that contain SSI and other .html pages that I want to be parsed with PHP.

    Anyone have a solution that could take care of both problems? On none of the pages is SSI and PHP BOTH used together, if that helps.

    Thanks.

  4. #4
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try renaming the files....
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  5. #5
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the sad part is...you really cant do both...(or at least I dont think its possible)

    when you loadup a php file on your server apache looks for what processes a php file so it will use the PHP processor to parse it...after that its spit back to the browser.

    So the easiest thing to do is just change the handler filenames to nto include .html and just include .shtml

    Also add the .html file to the php handler...give it a go

    but if you want the easiest solution...just rename to .php it wont hurt anything.
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer


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
  •