2

I try to redirect my website from www to no-www for whole content but I don't know how I get it work, because I've got two rewrite rules already.

This is my htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^meaning-first-name\.com$ [NC]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]

RewriteRule ^([^/\.]+)/?$ index.php?name=$1 [L]
RewriteRule ^([^/\.]+)?$ index.php?name=$1 [L]

RewriteRule ^voorletter/([^/\.]+)/?$ initial.php?letter=$1 [L]
RewriteRule ^voorletter/([^/\.]+)?$ initial.php?letter=$1 [L]

Now is working:

website.com/John* shows: *index.php?name=John

website.com/initial/J* shows: *initial.php?letter=J

But how can I include redirect for www to non-www to this?

4

1 回答 1

0

删除顶部的 2 个条件并添加它:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
于 2013-10-03T20:30:06.470 回答