I've used the following rule to redirect a non-www domain to www domain (Reference).
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
In this case the domain is redirecting to the www domain. This is due to full URL inclusion in the rule.
But is there a way to rewrite the domain to www instead of redirecting? I've tried some methods and doesn't worked. Someone experienced the same issue?