PHP code not working?

Status
Not open for further replies.

gnipun

New Member
Messages
3
Reaction score
0
Points
1
Hi,
I have some PHP code inside .html files, which was working fine until a couple of days ago.
Today, I noticed that all PHP files on my account were being downloaded. So, I had updated my .htaccess file to add 'AddHandler application/x-httpd-php5 .html .htm'. This prevented the files from being downloaded, but the code was NOT being executed (All PHP code was displayed as HTML).
I also noticed that if I didn't add 'index.html' to my site URL, it still caused the file to be downloaded. From another post, I added 'AddType text/plain .*' to my .htaccess file. This prevented the file download, but the the PHP code inside my HTML file is not being executed.
Is there something else I need to update?
Thanks!
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
Why are you not just using .php? This is the cleanest way to resolve the issue. There is a separate addhandler rule for the new version of Apache.
 

gnipun

New Member
Messages
3
Reaction score
0
Points
1
Hi, thanks for the quick reply.
I have a few pages that link to .html version of my site (and a lot of bookmarks). It would cause a lot of work updating everything. So, if possible I would really prefer to keep the HTML extension.
Would you happen to know what the addhandler rule is for this new version of apache?

Thanks!
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
You could use mod_rewrite to rewrite .html links to matching .php files.
 
Status
Not open for further replies.
Top