tags:

views:

50

answers:

3

Iam working on Ubuntu.(Linux)

I want to display all .php pages to .html in the browser, using .htaccess. Where all php files are in the folder 'test'

e.g one.php should be one.html like and all other files too

+3  A: 

I'm not very sure about what you are trying to do, but i guess that you are trying to redirect /test/foo.html to /test/foo.php you could try it with

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^(.+).html$ $1.php [QSA]
</IfModule>

hope it helps

markcial
A: 

You mean all requests made on a X.html page to be served as X.php by the server...

If you mean this then you have to write a ReWrite Rule in the .htaccess file that Directs apache to serve any requests for X.html as requests to X.php.

You can check the following urls for details

http://www.modrewrite.com/

http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html

You can also try

RewriteEngine On
RewriteBase /
RewriteRule ^(.+)\.html$ $1\.php [L]
andreas
A: 

You could name the files as .html and use this in htaccess:

AddType application/x-httpd-php .html

Or to keep the files as .php and just redirect .html to the PHP files use this:

RewriteEngine on 
RewriteRule ^(.*)\.html $1\.php
Tim