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

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.

Jump to Post

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

Jump to Post

if you're in windows, you can do it

Or any other operating system for that matter.

Jump to Post

All 10 Replies

Member Avatar

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

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

if you're in windows, you can do it

Or any other operating system for that matter.

Member Avatar

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.