Avatar of vzorn
Flag for United States of America asked on

htaccess php problems

I have inherited a site build using php.  The actual files are html and the htaccess file I believe tells the server to run the html files as php files.  Here is the code:

AddType application/x-httpd-php .html .htm .php .inc
XBitHack full

Options +FollowSymLinks

<IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteRule ^([^/]+).faq$ content.php?id=$1
      RewriteRule ^([^/]+).news$ content.php?id=$1
      RewriteRule ^([^/]+).blog$ content.php?id=$1

I had to get a new server.  It is LInux and I am using a Plesk interface.
I have created all the sites.  We have not changed the DNS until the sites are finished.
I cannot view the sites.  As soon as I put in the IP address the browser tries to download the index.html file.  
PHPApache Web Server

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
Ray Paseur

Try adding this to your .htaccess file.
AddType application/x-httpd-php5 .html .htm .php

Open in new window


I took out everything and just added the one line.  
It tries to download the index.html file still.

my phpinfo does not display the Apache information.
My hosting company keeps telling me it is running on the server.
I am using a Plesk interface
Your help has saved me hundreds of hours of internet surfing.

Does the downloaded file contain PHP code?

Actually, try creating a file like "info.php" and putting this in it:

Open in new window

Go to the PHP script directly.  If it tries to download, PHP isn't enabled; if it works (and you get information about PHP), then the problem is something with content type.
Ray Paseur

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Yes PHP is working, I get all of the phpinfo details.  
My hosting company is hostgator, we have VPS.
I will ask them to restart the server.

Ray Paseur

Hmm... Hostgator is pretty good about stuff like that.  What is the URL of your index.html?  Is the .htaccess script in the same directory?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Hostgator has fixed the issue. They restarted the server.  I am not sure if they did anything else.

thank you for your help!
Ray Paseur

Yeah, too bad you can't fix my car that way!  Thanks for the points, ~Ray