Solved

change php html

Posted on 2013-06-13
9
406 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
9 Comments
 
LVL 23

Expert Comment

by:tailoreddigital
ID: 39246423
0
 
LVL 58

Expert Comment

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

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

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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 109

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 55

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 55

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

830 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