Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

change php html

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

Expert Comment

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

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

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 60

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 60

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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)
Suggested Courses

972 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