Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
php extension to html
Old 05-25-2008, 04:44 PM php extension to html
Red_X_'s Avatar
Extreme Talker

Posts: 158
Location: Houston
Trades: 0
How do you go about making a .php to .html(change the extension in the browser)

example:

Default: site.com/index.php
want: site.com/index.html

Obviously i'll be using php. I just want to spoof it up I guess.

Thanks for your help,

Red_X_
__________________
"Good News Everyone, by reading this your hearing my voice."
Red_X_ is offline
Reply With Quote
View Public Profile Visit Red_X_'s homepage!
 
 
Register now for full access!
Old 05-25-2008, 06:17 PM Re: php extension to html
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
I think what you need is an apache rewrite instead of php (php just processes the page and not much more).

For example, in your .htaccess put the following:
Code:
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*).html$ $1.php [QSA]
Essentially, if someone wants site.com/index.html the server would access site.com/index.php and the user would have no idea.

If that seems a bit wasteful/insecure, you could also add an extension handler. Again in .htaccess put the following:
Code:
AddHandler application/x-httpd-php html
In this one, any file that ends in .html will be run as a php file.

A extension handler is a much more simpler way of doing things and you will not have 2 files (in a sense) floating about. It's up to you though
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 05-25-2008 at 06:21 PM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Reply     « Reply to php extension to html
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31406 seconds with 12 queries