Current location: Hot Scripts Forums » Programming Languages » PHP » how to show .html of .php page


how to show .html of .php page

Reply
  #1 (permalink)  
Old 06-13-05, 01:24 AM
jaishalg jaishalg is offline
Newbie Coder
 
Join Date: May 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation how to show .html of .php page

Hey all
i have a problem, can anyone help me please...
well well
i m developing a site in PHP, and i want to show the page extension as .HTML and not as .PHP..

eg. if i m having a page called "index.php"
than it should be look to the user as index.html.. and not .php

wat should i do for this. is it possible.. how to do this

please help me....
Reply With Quote
  #2 (permalink)  
Old 06-13-05, 04:25 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
look up 'htaccess using mod rewrite'
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #3 (permalink)  
Old 06-13-05, 04:20 PM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
This may be impossible to achieve if your hosting provider forbids to use the .htaccess files. Basicly this is not PHP-related problem, rather Apache-related issue. In general you will have to declare .html files as if they were of type application/x-httpd-php. In this case PHP will be used to display all static html files which will lead to a small overhead, but it will be working fine for .html files with PHP code inside.
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote
  #4 (permalink)  
Old 06-13-05, 04:44 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
sorry im too lazy create a file called '.htaccess' and upload it to the main directory with the following code:

Code:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html $1.php
then create a file called 'test.php' and in it put '<? echo "test"; ?>' and go to test.html on your site and see if the word 'test' appears...
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #5 (permalink)  
Old 06-13-05, 04:48 PM
yoey2k yoey2k is offline
New Member
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Easiest way : rename your file from script.php to script.php.html

You can now access that file by typing in script.html, and it has all the PHP functions.
Reply With Quote
  #6 (permalink)  
Old 06-13-05, 10:49 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Thumbs down

Quote:
Originally Posted by yoey2k
Easiest way : rename your file from script.php to script.php.html

You can now access that file by typing in script.html, and it has all the PHP functions.
You're joking, right?
Reply With Quote
  #7 (permalink)  
Old 06-18-05, 05:43 AM
jaishalg jaishalg is offline
Newbie Coder
 
Join Date: May 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Main directory??? means where exactly.
as i saved it in the public_html
is the correct place or anywhere else.???
and dont u think this file is already there should i replace it?
hummm i m so confused
guide me please
Reply With Quote
  #8 (permalink)  
Old 06-18-05, 08:43 AM
jordie jordie is offline
Wannabe Coder
 
Join Date: Jun 2005
Posts: 179
Thanks: 0
Thanked 0 Times in 0 Posts
if its already there, download it then add the bits said above, and reupload it.
__________________
Jordie Bodlay
php, mysql, postgres
css, xhtml
graphics, design
email me: jb2386@hotmail.com for any programming needs.
Reply With Quote
  #9 (permalink)  
Old 06-18-05, 12:20 PM
onlineworks onlineworks is offline
Newbie Coder
 
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Did not tested but I think you can also do this with "apache handlers" and to handle all your html files serverside and then rename all your php files to html but if you have really html files it will increase your server's load.
Reply With Quote
  #10 (permalink)  
Old 06-24-05, 03:56 AM
jaishalg jaishalg is offline
Newbie Coder
 
Join Date: May 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
well,
i want to do this as because it is the clients requirement.
well mod_rewrite doesnt work for this as i think.
cause it helps we to change the url of the site
but i want to change the extension of the page
from .php to .html

is it really possible.????
actually i have all the files in .php and in that files all the coding in php and there is some html part as well. now when ever user see the site i want to convert the page name from index.php to index.html, category.php to category.html
and as so onnnn

can any one please help me in this matter ... please i m confused guide me...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
Show hidden DIV from a link on another page? jbreaker HTML/XHTML/XML 8 07-11-05 06:48 PM
pass variables to a .php page within a page davidcsi PHP 2 04-21-04 07:34 PM
How do I show a row per page? tbig ASP 2 02-12-04 04:19 PM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 06:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.