How do you stop this .htaccess entry slowing your entire site down?

by Thomas
7 replies
Hello Warriors:

According to Hostgator, adding:

AddHandler application/x-httpd-php5 .html .htm

to your .htaccess file will make a html file run as php (without having to manually change the file extension).

This works fine, but I'm guessing it will make all pages on the site change (even though I only use PHP on one page)? Is that likely to slow everything down?

Regards,
Tommy.
#entire #entry #htaccess #site #slowing #stop
  • Profile picture of the author patey88
    Hey, I was researching this yesterday. I still have a browser tab open to this page, which explains how you can make it apply only to certain files...

    Run PHP from HTML - .html as .php - Execute PHP in .html

    -- Patey88
    {{ DiscussionBoard.errors[1929785].message }}
    • Profile picture of the author Thomas
      Thanks for that, Patey.

      I just tried it but, unfortunately, it didn't work. It just produces an internal server error.
      {{ DiscussionBoard.errors[1930075].message }}
      • Profile picture of the author patey88
        Sorry about that. I hadn't tried it yet, but was planning to. -- Patey88
        {{ DiscussionBoard.errors[1930121].message }}
  • Profile picture of the author jminkler
    Originally Posted by Thomas View Post

    Hello Warriors:

    According to Hostgator, adding:

    AddHandler application/x-httpd-php5 .html .htm

    to your .htaccess file will make a html file run as php (without having to manually change the file extension).

    This works fine, but I'm guessing it will make all pages on the site change (even though I only use PHP on one page)? Is that likely to slow everything down?

    Regards,
    Tommy.
    Just change the extension of the file to .php

    Yes, it will slow things down unless this is worked into the apache config, which you can't change unless your on a VPS etc.
    {{ DiscussionBoard.errors[1930137].message }}
    • Profile picture of the author Thomas
      Originally Posted by jminkler View Post

      Just change the extension of the file to .php
      I know you can do that, but the page is updated often and (admittedly out of sheer laziness ) I'd prefer to be able to simply upload the changed page without having to then manually change the file extension everytime.
      {{ DiscussionBoard.errors[1930358].message }}
      • Profile picture of the author jminkler
        Originally Posted by Thomas View Post

        I know you can do that, but the page is updated often and (admittedly out of sheer laziness ) I'd prefer to be able to simply upload the changed page without having to then manually change the file extension everytime.
        You don't have to. If you upload it as page.php that's how it stays?

        Not sure what your trying to do here.
        {{ DiscussionBoard.errors[1930483].message }}
        • Profile picture of the author Thomas
          Originally Posted by jminkler View Post

          You don't have to. If you upload it as page.php that's how it stays?

          Not sure what your trying to do here.
          I use a WYSIWYG editor with built-in FTP. (One click to update the page, but only creates .html files.)

          If I update (and re-upload) the page, after re-naming the uploaded index.html file to index.php, then index.php won't be overwritten - I'll just end up with both a .html and a .php index file.
          {{ DiscussionBoard.errors[1930830].message }}

Trending Topics