I have hundreds of domains so I needed an htaccess that would force www without knowing the exact domain name.
I got it to work, but then it started forcing www in front of ALL my subdomain URLs too, not just domain.com (ex: http://www.sub.domain.com). So I need something that will force www only if the user inputs domain.com.
I tried tweaking my original code and it's not working. Any suggestions?
RewriteCond %{HTTP_HOST} ^%{HTTP_HOST}$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST} [R=301,L]