Welcome Guest, Not a member yet? Register   Sign In
adding html extension
#1

[eluser]Unknown[/eluser]
I want to add .html extension behind some of the files of my site.As i have used codeigniter utility html that adds html extension behind all files.So i want any rewrite rule or configuration in CI to add html extension to limited or only required files.
#2

[eluser]tomcode[/eluser]
If I understand right, then You have some static html files which You want to show directly, only if the file does not exist, You want to use Your CI installation.

You can use this .htaccess file, it's not specially written for Yous case, but it will do serve any existing file, everything else is passed to the CI installation, it also takes out the index.php of the URL :
Code:
<IfModule mod_rewrite.c>

    RewriteEngine On
    
    # On some servers the base need to be set
    RewriteBase /

    # if file / folder does not exist
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    # Take out index.php
    RewriteRule ^(.*)$ index.php/$1 [L]
    
</IfModule>
#3

[eluser]Unknown[/eluser]
I applied that but it's not working.For example my url is http://test.com/contactus when i browse it should redirect http://test.com/contactus.html.Please guide me or help me to write rewrite rule.
#4

[eluser]tomcode[/eluser]
In my example You need to call http://test.com/contactus.html and it will show contactus.html when the file exists, otherwise it will call the CI installation.

To use addresses ending with .html (http://test.com/whatsoever.html) as address for CI, You need to set in the config

Code:
// not sure about the point, though
$config['url_suffix'] = ".html";
see User Guide - URL's

I do not know how to add a html suffix in a .htaccess file.
#5

[eluser]n_uryanto[/eluser]
thanks for question, i have solution now Smile

nuryanto




Theme © iAndrew 2016 - Forum software by © MyBB