1

I need to force www for my site, my site is build with codeigniter framework.

This is my htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|css|images|js|plugins|Scripts|pirobox|applications-assets|user-assets|robots\.txt)
RewriteCond %{HTTP_HOST} !^www\.(.*)
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^(.*)$ /index.php?/administrator/$1 [L]

But it is not working can you tell me what is wrong here?

Jeff Miller
  • 2,405
  • 1
  • 26
  • 41
App tester
  • 139
  • 1
  • 11

1 Answers1

4

Try Something like

RewriteEngine On                          
#This rewrites your host name to include www
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule ^(.*)$ /index.php/$1 [L]
Arun
  • 685
  • 5
  • 20