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
  • 121
  • 2
  • 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,728
  • 5
  • 21
  • 34
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
  • 135,941
  • 26
  • 200
  • 209