Solved

change php html

Posted on 2013-06-13
9
412 Views
Last Modified: 2013-07-01
Hi,

I have created a php template (index.php)to avoid using DW templates as I dont like the greyed out areas. The template works with just the html code inside them.

My issue is that the name of the file has to have php eg index.php and I want the page names to have html extension.

How can I change the extension to html so php works in it.

 
<body>

<div id="wrapper">

<?php include("includes/header.php"); ?>

<?php include("includes/nav.php"); ?>

<div id="content">


<h5>Heading5</h5>

<h3>Paragraph Element</h3>

<p>

Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit.

</p>





</div> <!-- end #content -->

<?php include('includes/sidebar.php'); ?>
<?php include('includes/footer.php'); ?>



		</div> <!-- End #wrapper -->   </body>


</body>

Open in new window

0
Comment
Question by:jagguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39246425
Add this to your .htaccess

AddHandler application/x-httpd-php .html
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 39246846
Here is a the basic .htaccess you need to solve this - this will first check to see if the html file exists and will then rewrite the url to .php so you can support both

AddType x-mapp-php5 .php
Options +FollowSymLinks

RewriteEngine on
RewriteBase /
# if all you want to do is change the index file then you can stop after the following line
RewriteRule index\.html$ index.php [L,NC,QSA]
# Condition that .html file must not exist 
RewriteCond %{REQUEST_FILENAME} !-f
# change any request for a .html file to its php equivalent and append the query
# parameters (if any)
RewriteRule (.*)\.html$ $1.php [L,NC,QSA]

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39246934
I'm with GaryC123.  Just parse the HTML documents through the PHP machine.  Here is my typical .htaccess

ErrorDocument 404 /404handler.php
AddType application/x-httpd-php5 .html .htm .php

Open in new window

0
 

Author Comment

by:jagguy
ID: 39254942
Hi,

I located this file in easyPHP setup in a seltup/lib directory and I couldnt open it. I change this file to a text and it was blank..


Where is this file htaccess?
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 39255340
In the root of your site (usually). If it is not there - create it.
0
 

Author Comment

by:jagguy
ID: 39265020
If it isnt there I create this file? This doesnt sound right
0
 
LVL 58

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39265215
Why not?

.htaccess is not required by default - you use it to do further configuration on your site.
0
 

Author Comment

by:jagguy
ID: 39269204
this is why not as easyphp doesnt use this file

http://stackoverflow.com/questions/8158770/easyphp-and-htaccess
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question