AddHandler for php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • earth-friendly
    Junior Member
    • Jan 2006
    • 18

    AddHandler for php

    I currently have the line in my .htaccess files:
    AddHandler application/x-httpd-php5 .php .php3 .html .htm

    In a post that Andrew did for the php5 upgrade, he said that we shouldn't have this line, so that in the future, if the servers are upgraded to, say, php6, this wouldn't work. However, is there any type of AddHandler that would say, use the default version of php for these file extensions (rather than this one, which says, use php5 for these file extensions)?
    The problem is that I need my .html (and other non-php extension) files processed as php files.

    Thanks,
    -Lori-
  • AndrewT
    Administrator
    • Mar 2004
    • 3653

    #2
    You'll need to use that line and make sure that it stays updated in order to force alternative extensions to be executed by PHP. Generally it is better just to rename the files.

    Comment

    • earth-friendly
      Junior Member
      • Jan 2006
      • 18

      #3
      I'm building a new website, and most of the files will be .php. However, I do have an index.html file from my current site, and I thought I should keep it as index.html for the new site, instead of index.php, since I have lots of links to it already, and it ranks pretty well in google for certain keywords.

      If I rename it to index.php, and have a redirect in .htaccess, from index.html to index.php, with a 302 (permanently moved) code, will that work ok in the search engines, or will I lose my ranking that I had for index.html?

      Also, would I need to add anything to the .htaccess, like a DirectoryIndex directive, or would it use index.php if there is no index.html?

      Thanks!

      Comment

      • AndrewT
        Administrator
        • Mar 2004
        • 3653

        #4
        I cannot offer you SEO advice. You would be best off consulting someone that specializes in this.

        If no index.html is present, the index.php will load.

        Comment

        • ZYV
          Senior Member
          • Sep 2005
          • 315

          #5
          You are not obliged to use external redirects in such a case, e.g. you can make use of mod_rewrite capabilities:

          RewriteRule ^(/?)index.html$ index.php [L]

          P.S. I am not sure whether / is necessary or not.

          Comment

          Working...