Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

change php html

Posted on 2013-06-13
9
Medium Priority
?
419 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 59

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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
LVL 111

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 59

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 59

Accepted Solution

by:
Julian Hansen earned 2000 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

660 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