I have PHP scripts inside my HTMl file. I am using Apache. I created a .htaccess file and place it in my root directory of the application with the following as its contents

AddType application/x-httpd-php .php .html .htm

I want to allow the server to execute the PHP scripts inside the HTML files.

Thanks in advance.

Recommended Answers

All 10 Replies

Member Avatar for diafol

Why not just rename the extensions to .php?

This means the server has to process all html files, whether they contain php or not. You can mod_rewrite urls if you don't want to see a file extension at all.

if you're in windows, you can do it

yea... am using windows.. I wanted to rename the extension to PHP but my supervisor didn't wanted it like that..

Thanks for your responses!

Member Avatar for diafol

Get your supervisor to explain to you why his way is better.

Member Avatar for iamthwee

if you're in windows, you can do it

Or any other operating system for that matter.

Member Avatar for diafol

if you're in windows, you can do it

Waste of time noob post - best ignored.

Ditto Diafol above
get the supervisor to explain why they want to break a funtional system

Hi,

As per my understanding you need all files are in .htm or .html but work like .php files.
i.e. aboutus.htm will work like aboutus.php, am I correct?

Please let me know.
Thanks,
Ajay

I had a talk with my supervisor and he said that he wanted to see if I would be able to figure it out. I got it to work. It turns out that I did not place the .htaccess file in the root directory.

But he told me that I can use the php extension for the application...

Thanks for your responses.

just rename the extension .php

commented: read the posts before repeating -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.