Hi i am using Codeigniter PHP framework.
Is there is any way to display .html extension rather than .php extension in URL?
Set your url suffix on your config.php found here
/application/config/config.php
$config['url_suffix'] = '.html'; //@ line 60ish
I haven't actually tried it myself but see the section Adding a URL Suffix in this part of the user guide.
If ur using APache. You can use URL Rewrite Rule.
As others said, creating a .htaccess file will allow you to rewrite .php to .html. The following code should do the trick:
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.html$ $1.php [L]
I am interested as to why you actually want to do this though. Codeigniter, by default, uses a segment based approach which is friendly and does away with query strings and file extensions. Using another htaccess rule, you can remove index.php from the url to make them even cleaner:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
So your urls can look like this: example.com/home, example.com/about etc. This is much prettier than having a file extension in the url.
More information about codeigniter URLs can be found here: http://codeigniter.com/user_guide/general/urls.html