is there a way to make .html files process php tags?

Recommended Answers

All 11 Replies

Search the forums for AddHandler

I tried search the forums for AddHandler but I cannot come across the solution...

Can you link it?

Thanks,

Add this to an .htaccess file in the directory...
(or apache.conf).
(This is for .html files being parsed by php)

AddHandler application/x-httpd-php .html

for .htm files

AddHandler application/x-httpd-php .htm

Ok thanks for the link...

I have added

AddHandler application/x-httpd-php .html

to my .htaccess file...

Now here's the problem... I have installed what is called a php gallery named MG2 which can be accessed by clicking here

http://www.elitedvservices.com/mg2/index.php

Now on the website I'm trying to add a code so that it includes that file...basiclly just trying keep up the same layout and just showin the gallery...if you click this link you'll see that its trying to install the gallery again but yet the gallery is already installed....hosting @ hostamina

http://www.elitedvservices.com/index_1col_top2.html

Here's how I have the code...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Elite D&V Services Inc - 25 Years Experience</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style/style_1col_top.css" />
<link rel="stylesheet" type="text/css" href="style/colour.css" />
<style type="text/css">
<!--
.style1 {font-size: 200%}
-->
</style>
</head>
<body>
<div id="main">
  <div id="logo">
    <h1>&nbsp;</h1>
  </div>
  <div id="menubar">
    <ul id="menu">
      <li><a class="current" href="index.html">Home</a></li>
      <li><a href="index_2col_right.html">Events</a></li>
      <li><a href="index_1col_bottom.html">About Us </a></li>
      <li><a href="index_1col_top.html">Contact Us </a></li>
	  <li><a href="index_1col_top2.html">Pictures </a></li>
    </ul>
    <div id="search">
    </div>
  </div>
  <div id="site_content">
    <div id="content">
      <h1 class="style1">&nbsp;</h1>
	  
<?php
include("mg2/index.php");
?>

	    <p>&nbsp;</p>
    </div>
  </div>
  <div id="footer"> 
    <p>Copyright &copy; Elite D&V Services Inc, | <a target="_blank" href="http://validator.w3.org/check?uri=referer">XHTML 1.1</a> | <a target="_blank" href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>
      <br />
      <a target="_blank" href="http://www.elitedvservices.com">http://www.elitedvservices.com</a></div>  
</div>
  <br />

</div>
</body>
</html>

Thanks,

First welcome to daniweb as I see your a new poster.
Second, please don't bump really old topics again as it can be really annoying at times. Especially for those who have subscribed to the thread.
And as for the answer, in your /mg2/ directory place a htaccess file with the following code.

order deny[B],[/B]allow
deny from all

First welcome to daniweb as I see your a new poster.
Second, please don't bump really old topics again as it can be really annoying at times. Especially for those who have subscribed to the thread.
And as for the answer, in your /mg2/ directory place a htaccess file with the following code.

order deny[B],[/B]allow
deny from all

Thank you and sorry for bumping old topic...

Back to the subject... I did as you told me... and still nothing

This what my root directory .htaccess file looks like

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName elitedvservices.com
AuthUserFile /home/elitedvs/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/elitedvs/public_html/_vti_pvt/service.grp


AddHandler application/x-httpd-php .html

Thank you and sorry for bumping old topic...

Back to the subject... I did as you told me... and still nothing

This what my root directory .htaccess file looks like

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName elitedvservices.com
AuthUserFile /home/elitedvs/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/elitedvs/public_html/_vti_pvt/service.grp


AddHandler application/x-httpd-php .html

I was meaning that you have 2 htaccess files. The htaccess file you posted plus the following in the directory that has your php files which you don't want people to access (only access through mod_rewrite):

order deny,allow
deny from all

So consider this for an idea. Place your entire website in a foder called /z/ then in the directory /z/ place a htaccess file with the following code:

order deny,allow
deny from all

Just remember the directory name is the letter z lower case
Then in the root directory which is the folder/directory above website place the following .htaccess file which is the same spot you mentioned your previous htaccess file

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName elitedvservices.com
AuthUserFile /home/elitedvs/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/elitedvs/public_html/_vti_pvt/service.grp

RewriteEngine on
/?([^z][^/].*\.html)$ /z/$1.php
/?([^z][^/].*\.[^p][^h][^p])$ /z/$1

That is from the top of my head but you get the point.

I got two .htaccess files...the one on my main root aka public_html containing the info I showed you...

And inside the folder MG2 I have created another one and added just the code you gave me bro...

Thanks,

So is this solved and I think when you refered to the MG2 folder shouldn't the name of it be just the letter z to match the htaccess files. Then it should be working.

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.