Reputation: 131
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?
Upvotes: 0
Views: 86
Reputation: 143906
Add this to the top of your file (right below RewriteEngine On
:
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://$1/$1 [L,R=301]
Upvotes: 0
Reputation: 5994
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]
Upvotes: 1