0

I have a simple .htaccess file

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule (.*) index.php/$1 [L]

and now would like to add redirect from all www cals to non www

how to combine it with my file?

olechafm
  • 131
  • 3
  • 10

2 Answers2

1
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1 [L]

RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
Joe Conlin
  • 5,976
  • 5
  • 25
  • 35
0

Add this to the top of your file (right below RewriteEngine On:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://$1/$1 [L,R=301]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220