Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SuPHP Question - making .html files behave as .php files

Discussion in 'General Discussion' started by Doug E, Mar 29, 2010.

  1. Doug E

    Doug E Well-Known Member

    Aug 17, 2005
    Likes Received:
    Trophy Points:
    I recently added SuPHP to my server and a lot of my old html pages I had set to act as php are no longer working because of the no php in .htaccess bit.

    I've been looking all over for a solution to this. Is there something I can replace the htaccess line I had with something in php.ini?

    My old htacess line was

    AddType application/x-httpd-php .html
    Here's just some similar htacess commands for people searching for help with this same problem.

    AddType application/x-httpd-php .html
    AddType application/x-httpd-php .html .htm .php
    AddHandler x-httpd-php .html .htm .cgi .php
    AddType x-mapp-php4 .html .htm .php
    AddHandler server-parsed .html .htm .php
    AddType application/x-httpd-php4 .htm .html .php
    AddHandler application/x-httpd-php5 .html .htm .php
    #1 Doug E, Mar 29, 2010
    Last edited: Mar 29, 2010
  2. Spiral

    Spiral BANNED

    Jun 24, 2005
    Likes Received:
    Trophy Points:
    I strongly recommend that you DO NOT parse .html files as PHP scripts.

    There is ways you can set this up to work even under SuPHP but it is a very bad idea for a lot of technical reasons and will also substantially increase loads to your server and is generally a very bad idea.

    It is much smarter and wiser to properly rename all your .html files to .php and then setup a redirect mapping the original .html URLs to the .php filenames and by doing that, there is no need to update the links in all your files which I am sure is what you are trying to avoid by the question.

    Doing things this way, you do not causing unnecessary loads to your server or the many other issues that can be caused by doing what you were asking about but still effectively be able to do the same thing.
  3. handsonhosting

    handsonhosting Well-Known Member

    Feb 17, 2002
    Likes Received:
    Trophy Points:
    Omaha, NE
    cPanel Access Level:
    Root Administrator
    With SuPHP you'll want to use the AddHandler option in your .htaccess file instead of the AddType;

    AddHandler application/x-httpd-php5 .php .html .htm
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. equens

    equens Well-Known Member

    Feb 8, 2002
    Likes Received:
    Trophy Points:
    Strange error

    This worked for me but only when accessing to the entire url like http://[B]www[/B]

    But when I go to Google Chrome asks to download a php file instead of opening the page.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice