Solved

change php html

Posted on 2013-06-13
9
394 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 51

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
 
LVL 108

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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 51

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 51

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
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.

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now