I am facing an issue for my .htaccess redirect to www from non www I like to redirect any tld domain like .com or .co.uk etc. I am using the following solution, from this link [Redirect non-www to www in .htaccess
# Redirect to www
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
but it only redirect tld with .com/.net etc but can't figure out how to change this so that it can grab any tld like .co.uk or .co.in etc.
EDIT: I have sub-domain there as well so using following rule not gonna work.
RewriteCond %{HTTP_HOST} !^www\.
Thanks in advance.