Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^www\.example\.uk$ [NC]
RewriteRule ^(.*)$ http://www.example.co.uk$1 [R=301,L]
but just changing wwws to * didn't seem to work...
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.uk$ [NC]
RewriteRule (.*) http://%1example.co.uk/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(\w+)\.example\.uk
RewriteRule (.*) http://%1.example.co.uk/$1 [R=301,L]
immediately followed by RewriteCond %{HTTP_HOST} ^example\.
RewriteRule (.*) http://www.example.co.uk/$1[R=301,L]
Note that in the second rule nothing is said about TLD; the same rule applies to both "example.uk" and "example.co.uk" since both are now wrong. example.example.co.uk would get incorrectly redirected