Now i have rule in .htaccess redirect ( wildcard is on ) many subdomains to other domain.
For example: subdomain123.domain.com --> other-domain.co.uk/subdomain123
but redirect with www don't work. For example: www.**subdomain123.domain.com --> other-domain.co.uk/subdomain123 - **404 error - please help with www.
RewriteCond %{http_host} .
RewriteCond %{http_host} !^domain.com [NC]
RewriteCond %{http_host} ^([^.]+)\.domain.com [NC]
RewriteRule ^(.*) http://other-domain.co.uk/%1 [R=301,L,QSA]
Try changing the condition to optionally match a "www":
RewriteCond %{http_host} .
RewriteCond %{http_host} !^domain.com [NC]
RewriteCond %{http_host} ^(www\.)?([^.]+)\.domain.com [NC]
RewriteRule ^(.*) http://other-domain.co.uk/%2 [R=301,L,QSA]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.