I'm having a problem I just want to redirect the mydomain.com to www.mydomain.com, but the solutions I've found make my oder subdomains like admin.mydomain.com redirect to www.admin.mydomain.com. I have an Ubuntu 14.04 with Apache and working with Laravel (PHP).
I just want this to happen when is the mydomain.com/.... to www.mydomain.com/... but no when there is something else at the beginning like admin.mydomain.com
I leave here the solution I found but that has this little problem I just explained.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]