CodeIgniter 301 redirection through .ht access file

How to redirect a index-page in main URL with www which main framework means site become in CodeIgniter. So how i redirect the main Domain with www & redirect index page to main Domain.

I put the redirection code in .htaccess file but not Done.

Hi,

Usually you need to add something like this to your .htaccess file:


# force non-www domain
RewriteCond %{HTTP_HOST} ^www\\.example\\.com$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]

but it needs to come before the other codeigniter-specific rewrite rules.