The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

    Joined:
    Aug 17, 2005
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    6
    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

    Code:
    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

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    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

    Joined:
    Feb 17, 2002
    Messages:
    151
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    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
     
  4. equens

    equens Well-Known Member

    Joined:
    Feb 8, 2002
    Messages:
    270
    Likes Received:
    0
    Trophy Points:
    16
    Strange error

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

    But when I go to http://mysite.com/doc.html Google Chrome asks to download a php file instead of opening the page.
     
Loading...

Share This Page